Skip to main content

Transform Google Sheets into a Powerful Database

ServiceSQL is an Eloquent-inspired ORM library for Google Apps Script that brings Laravel-style Models, QueryBuilder, Collections, and Relationships to Google Sheets.

Quickstart

Get started with ServiceSQL in under 5 minutes

Installation

Install ServiceSQL as a Google Apps Script library

Models

Define Eloquent-style Models with timestamps and casts

Query Builder

Build complex queries with a fluent API

Key Features

Eloquent Models

Define Models with automatic timestamps, soft deletes, and type casting

Fluent QueryBuilder

Build queries with WHERE, JOIN, GROUP BY, and aggregations

Relationships

Connect Models with BelongsTo, HasMany, HasOne, and ManyToMany

Collections

Transform data with 50+ Laravel-inspired collection methods

Eager Loading

Prevent N+1 queries with automatic eager loading

Type Casting

Automatically cast values to int, bool, json, date, and more

Quick Example

Here’s how easy it is to work with ServiceSQL:
// Initialize ServiceSQL
const db = APPSQL.init({
  spreadsheetId: "YOUR_SPREADSHEET_ID"
});

// Define a Model
class User extends Model {}
User._table = "Users";
User._timestamps = true;
User._fillable = ["name", "email", "age"];
User._casts = { age: "int", verified: "bool" };
User.use(db);

// Create a user
const user = User.create({
  name: "John Doe",
  email: "[email protected]",
  age: 30
});

// Query users
const activeUsers = User.where("status", "active")
  .where("age", ">=", 18)
  .orderBy("name")
  .get();

// Work with relationships
class Post extends Model {}
Post._table = "Posts";
Post.author = function() {
  return this.belongsTo(User, "user_id");
};
Post.use(db);

// Eager load relationships
const posts = Post.with("author").get();
posts.each(post => {
  Logger.log(`${post.title} by ${post.author.name}`);
});

Why ServiceSQL?

Familiar API

If you know Laravel Eloquent, you already know ServiceSQL

No External Dependencies

Pure JavaScript for Google Apps Script

Production Ready

Battle-tested features with comprehensive documentation

Developer Experience

Clean, fluent API that makes your code readable and maintainable

Get Started

1

Install the Library

Add ServiceSQL to your Google Apps Script project as a library
2

Initialize

Configure ServiceSQL with your spreadsheet ID
3

Create Models

Define your data models and relationships
4

Build Queries

Query your data with the fluent QueryBuilder

Ready to get started?

Follow our quickstart guide to build your first ServiceSQL application

Build docs developers (and LLMs) love