Read a Google Sheet with GraphQL NodeJS Server.
Requires creating credentials in gCloud Console and setting up .env like so:
GOOGLE_APPLICATION_CREDENTIALS=<PATH to YOUR CREDENTIALS.JSON>
SPREADSHEET_ID=<AN ID OF A SPREADSHEET>
And adding the email address from the credentials.json file to the spreadsheet id you are trying to access.
While this will connect to any sheet, you need to modify the schema to support your sheet.
These set up steps ar modified from this URL
Go to https://docs.google.com/spreadsheets/, sign in to your Google / Gmail account, and create a spreadsheets.
You need to create or use an existing project in the Google Developers Console as a first step.
Once signed in, you'll see a list of existing projects. Click Create Project to create a new one.
In the Developers Console's navigation menu, click on APIs and Services and select Library.
Ensure the correct project is selected at the top of the page. Then search for and click Google Drive API and Enable.
Return to the library, then search for Google Sheets API and click Enable.
From the main navigation menu, click APIs and Services then Credentials.
On the Credentials page, click Create credentials and select the Service account option.
Enter a name and role for your service account.
Add a key to your service account. Click to edit the new service account, and then click Add Key. Choose a JSON key type.
Download the certificate file and put it in this directory. Make sure it is named credentials.json
You will also need to save the service account email address. Copy and paste this from the service account details.
Now that the credentials have been generated, they must also be authorized to access the spreadsheet data. Sign into Google Sheets and open the spreadsheet that you want to connect to. Click the Share button in the top right corner. Enter the Service account email address which you created above. Share this spreadsheet with the Service account email address.
You should be able to start the app and connect to the sheet using GraphQL