I created this as a way to explore with Google Sheets API, with a service account (to support another exploratory effort on backend related syncing with sheets). The requisites of running this project will be explained in the following.
This demo shows a simple application of node API for google sheets, and being able to read, write, and delete entities.
- Install NPM
- Clone this project
- Run
npm i
from the root of this project - Create a GCP project here
- Enable Google Sheets API for the newly created project here
- Create a service account for your project here, and download the credentials indicated at the end of the setup process. Save this file in the
.tmp
hidden folder, or a separate location as long as you add the location in.gitignore
- Create a new Google Sheet (private or public will both work with this demo)
- Invite the service account above to this new sheet, with write access.
- Copy
env.sample
to.env
, and fill in the missing entries.- GOOGLE_APPLICATION_CREDENTIALS - location of service account credentials file from the end of step 6
- GOOGLE_PROJECT - project id from the end of step 4
- USERS_SHEET_DATABASE_ID - google sheet id from end of step 7. I found the id directly from the URL when accessing the sheet.
- USERS_SHEET_ID - name of the active sheet that will act as your "users" table.
Run npm run start
to start the server in your local machine!