examples/functions-google-sheets/README.md
Get Google Authentication Token.
This sample uses the Google Service account to authenticate into Google Spreadsheet API. To receive the proper token information, you'll need to set up an account in the Google API Console.
.env.development file. Copy into it from the downloaded JSON key file:GOOGLE_SERVICE_ACCOUNT_EMAIL=copy service account email
GOOGLE_PRIVATE_KEY=copy private key
Create a Test Spreadsheet.
https://docs.google.com/spreadsheets/d/<GOOGLE_SHEET_ID>/. Add this to your .env.development file as well.Start developing.
To get started, run npm install to add all necessary packages.
When developing locally, you'll want to include the ENV variables in your .env.development. Read more about how Gatsby handles .env files and environment variables in the Gatsby Docs
cd examples/functions-google-sheets
npm install
npm run develop
Open the code and start customizing!
Your site is now running at http://localhost:8000! You can use the UI on the index page to test the functions or directly access them at http://localhost:8000/api/sheets
Edit src/pages/index.js to see your site update in real-time!
Deploy
You can deploy this example on Gatsby Cloud by copying the example into a new repo and connecting that to Gatsby Cloud.