- Copy the SITE_URL from the project name and paste to the environment variables.
- IAM and admin -> Service accounts -> CREATE SERVICE ACCOUNT
Ref: https://cloud.google.com/docs/authentication/getting-started?hl=en#creating_a_service_account
- IAM and admin -> Service accounts -> click $EMAIL -> KEYS -> ADD KEY -> Create new key
Ref: https://cloud.google.com/docs/authentication/getting-started?hl=en#creating_a_service_account
- Create the Google Sheets.
- Give Google Sheets access of Editor to the
client-email
defined in the service account key JSON image source: screenshot from https://www.youtube.com/watch?v=_S-_wrgPGgo&t=518s - Copy the SHEET_ID from the URL and paste to the environment variables.
https://docs.google.com/spreadsheets/d/{SHEET_ID}/edit#gid=0
4. Copy the target SHEET_NAME and paste to the environment variables.
- Open the terminal config file with command line editor
or
vim ~/.zshrc
vim ~/.bashrc
- Add the environment variable to the terminal config file
export GOOGLE_APPLICATION_CREDENTIALS="/$PATH_TO_THE_SERVICE_ACCOUNT_JSON_FILE"
- Notes: Replace
$PATH_TO_THE_SERVICE_ACCOUNT_JSON_FILE
with the path you store the key JSON file generated by the Google service account. - Ref: https://cloud.google.com/docs/authentication/getting-started?hl=en#creating_a_service_account
- Notes: Replace
Required environment variables in the .env file, which should be located at the root directory of the project
SITE_URL=""
SHEET_ID=""
SHEET_NAME=""