spreadsheetdb
Fluent & complete API for working with Google Sheets.
Usage
var Sheet = var sheet = sheet
Installation
npm install spreadsheetdb
Authenticate with Google Sheets
You have to do this once.
To use this tool, you must first set up a service account on the Google Developers Console.
- Create a project
- Select Add Credentials, and select Service Account. (Make sure to create a JSON key type)
- Once the account has been created, generate a new JSON key. This will be used as credentials to connect to the Google Sheet.
You have to do this each time you create a new database
- Create a new Google Sheet
- Share the sheet with the service account, allowing edit access to the service credentials, it should look something like this:
sheetsdb@sheetsdb-1165.iam.gserviceaccount.com
API
Sheet(credentials)
Authenticate with Google. credentials
requires the following:
- client_email (ex.
sheetsdb@sheetsdb-1165.iam.gserviceaccount.com
) - private_key (ex.
-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCe6y ...
)
sheet.load(url)
Load a specific sheet by its url
or id.
sheet.create(table)
Create a new table. In Google Sheet speak, this is a new worksheet.
sheet.insert(table, object)
Insert a new row into the database
sheet
sheet.update(table, query, update)
Find and update rows in a table.
sheet
sheet.query(table, query)
sheet
sheet.columns(table)
Get the table columns
sheet.columns(table, columns)
Set the table columns
sheet
License
MIT