gsheets-db.js - v1.0.3
    Preparing search index...

    Class SheetsDB

    Create a new table in the spreadsheet.

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Initializes a new instance of the SheetsDB class and sets up the Google auth client. *

      Parameters

      • options: DBOptions

        The database configuration options.

      Returns SheetsDB

      Will throw an error if any required option is missing.

    Properties

    config: DBOptions

    The current database configuration options.

    Methods

    • Verifies if the target sheet exists and creates it if not. It also verifies and applies the schema headers to the first row if missing.

      Returns Promise<boolean>

      A promise that resolves to true once the table is ready.

      Will throw an error if the API request fails.

    • Retrieves all rows from the sheet and maps them to an array of objects using the first row as the keys.

      Returns Promise<Record<string, any>[]>

      A promise that resolves to an array of key-value records.

      Will throw an error if the API request fails.

    • Bootstraps the database connection. Ensures that the target sheet and schema headers exist before proceeding.

      Returns Promise<SheetsDB>

      The initialized instance of SheetsDB.