Result Screenshot

Google Search Console

  1. Copy the SITE_URL from the project name and paste to the environment variables.

Google service account

Create service accounts

Generate service account key JSON file

Google Sheets

  1. Create the Google Sheets.
  2. 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
  3. 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.

Environment variables

GOOGLE_APPLICATION_CREDENTIALS

  1. Open the terminal config file with command line editor
    vim ~/.zshrc
    or
    vim ~/.bashrc
  2. Add the environment variable to the terminal config file
    export GOOGLE_APPLICATION_CREDENTIALS="/$PATH_TO_THE_SERVICE_ACCOUNT_JSON_FILE"
    

Required environment variables in the .env file, which should be located at the root directory of the project

SITE_URL=""   
SHEET_ID=""   
SHEET_NAME=""   

Tutorials reference