This NPM Package allows you to use a Google Spreadsheet as a database within your Node Js project.
There are 2 setup parts in order to get this package working. The first part is setting up the API endpoint that calls routes to my script endpoint within a Google Script on your Google Drive. The second part is installing the NPM package and connecting to your the database via the deployment ID.
-
Add the MCLib script as a library to your script
1wuipW_9oqNOq1l0bdbLiIrt5JnX8xzI_Bb7jA7rRzArfpfmys_7wNlgU
-
Add doPost method that redirects to the MCLib doPost method
const doPost = (e) => MCLib.doPost(e)
-
Set up your Node Project with
node init
-
Load this library into your project
const googlesheetdatabase = require("google-sheet-database")
-
Create a schema for a new table
SampleSchema = new googlesheetdatabase.schema( ["id", "column1", "column2", "column3"] )
-
Create a model for the schema
SampleModel = new googlesheetdatabase.model("SampleModel", SampleSchema)
-
Connect to the database
googlesheetdatabase.connection.connect({ databaseName: YOUR_DATABASE_NAME, apiKey: YOUR_DEPLOYMENT_ID })
WIthin this file you will see examples of all the different CRUD operations that can be performed. Below lists them for reference.