A lightweight package that allows you to use spreadsheet as a database very easily
- Easy-to-use methods
- Write, read, update and delete data from spreadsheet
- Search for specific queries in the sheet
- Support for multiple sheets in one doc
- npm:
npm i sheetflow
- yarn:
yarn add sheetflow
-
The service account key file.
- Create a project at https://console.cloud.google.com
- Enable Sheets API. Go to
APIs and services
>Library
, search and enableGoogle Sheets API
- Create a service account. Go to
Credentials
>Create Credentials
>Service Account
- Select the newly created service account, go to
Keys
>Add new key
>Create new key
> Select JSON as type and save the JSON file at your project directory
-
The base google sheet.
-
The Google doc ID, obtain it from the url :-
https://docs.google.com/spreadsheets/d/1SmVEJqgPVDu6_0TyusWpAX7xWV7c6GGrTyv72aY38ac/edit?usp=sharing
id for the above sheet:
1SmVEJqgPVDu6_0TyusWpAX7xWV7c6GGrTyv72aY38ac
- The sheet name from the google doc, you can have multiple class instances for each sheet.
-
The range of the stored data, if you don't know what this is just put
A:Z
-
The Google doc ID, obtain it from the url :-
https://docs.google.com/spreadsheets/d/1SmVEJqgPVDu6_0TyusWpAX7xWV7c6GGrTyv72aY38ac/edit?usp=sharing
id for the above sheet:
- Authorizes and connects to the Google Sheets API.
- Read all the data from the current sheet - no parameters needed.
- Write to the sheet, param data must be an array of strings.
-
Update a cell's value. The param data must be an object, sheetflow by default searches and updates the first entry that has the same value as the first prop of object data.
const data = { id: "44", email: "cool@gmail.com" } db.update(data) // sets the email of entry by id "44" to cool@gmail.com
- Search for a specific entry from the database, param query must be a string.
- Deletes the entry by the provided rowIndex.