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

    gsheets-db.js - v1.0.3

    gsheets-db.js

    NPM Version License Node Version

    gsheets-db.js is a lightweight and fast wrapper for using Google Sheets as a database in your Node.js projects. Built with TypeScript for maximum type-safety and full Intellisense support (Not official Google NPM package!).

    You can install the library via NPM:

    npm install gsheets-db.js
    

    Before using the library, ensure you have a creds.json file from a Google Cloud Service Account.

    1. Create a project in Google Cloud Console.
    2. Enable the Google Sheets API.
    3. Create a Service Account and download the JSON key.
    4. Share your Google Sheet with the email address of the service account.

    import { SheetsDB } from "gsheets-db.js";
    import creds from "./creds.json" with { type: "json" };

    // Configure the database.
    const usersDB = new SheetsDB({
    credentials: { clientEmail: creds.client_email, privateKey: creds.private_key },
    sheetName: "users",
    // sheetNamt is the sheet in the spreadsheet.
    spreadsheetId: "spreadsheet id, can be found by the url of the spreadsheet",
    schema: ["id", "name", "email"]
    });

    // Initialize the database
    await usersDB.init();

    // Get all the data in the table
    const all = await usersDB.getAll();
    console.log(all);

    The full documentation is available at: https://yossi-batash.github.io/gsheets-db.js/


    Distributed under the ISC License. See LICENSE for more information.


    Developed with ❤️ by Yossi Batash