Corsair
PluginsGoogle Sheets

Google Sheets Database Schema

Database entities and querying synced Google Sheets data

The Google Sheets plugin automatically syncs data from Google Sheets to your database. This allows you to query spreadsheet data without making API calls, providing faster access and offline capabilities.

New to Corsair? Learn about core concepts like database operations, data synchronization, and multi-tenancy before working with the database.

Full Implementation: For the complete, up-to-date database schema and implementations, see the Google Sheets plugin source code on GitHub.

Synced Entities

The Google Sheets plugin syncs the following entities to your database:

  • spreadsheets - Spreadsheet documents
  • sheets - Individual sheets within spreadsheets
  • rows - Row data from sheets

Database API

Access synced data through the db property:

const spreadsheets = await corsair.googlesheets.db.spreadsheets.search({
    data: { title: "My Spreadsheet" },
});

Spreadsheets

Schema

{
    spreadsheetId: string;
    title?: string;
    spreadsheetUrl?: string;
    createdAt?: Date;
}

Querying Spreadsheets

Search by title:

const spreadsheets = await corsair.googlesheets.db.spreadsheets.search({
    data: { title: "My Spreadsheet" },
});

Sheets

Schema

{
    sheetId: string;
    spreadsheetId: string;
    title?: string;
    index?: number;
    createdAt?: Date;
}

Querying Sheets

Search by spreadsheet:

const sheets = await corsair.googlesheets.db.sheets.search({
    data: { spreadsheetId: "spreadsheet-id" },
});

Rows

Schema

{
    rowId: string;
    spreadsheetId: string;
    sheetName?: string;
    range?: string;
    values?: Array<string | number | boolean | null>;
    createdAt?: Date;
}

Querying Rows

Search by spreadsheet:

const rows = await corsair.googlesheets.db.rows.search({
    data: { spreadsheetId: "spreadsheet-id" },
});

See Database for more information about database concepts and querying patterns.