Reputation: 13
I am trying to call the Google Sheets API via a Google Apps Script. As an example, I have followed the instructions provided here:
https://developers.google.com/sheets/api/quickstart/js
I have generated the client ID and API Key via my Google Cloud Platform project as suggested elsewhere.
Now, I have created a google apps script with two files, the Code.gs file and a file called index.html containing the code copied and pasted from the Google Sheets API Quickstart above (with my client ID and API inserted).
When testing deployment, I get the following error message:
{
"error": "idpiframe_initialization_failed",
"details": "Not a valid origin for the client: https://<some numbers>-script.googleusercontent.com has not been registered for client ID <MY_CLIENT_ID>. Please go to https://console.developers.google.com/ and register this origin for your project's client ID."
}
I have registered script.google.com as an origin for my project.
Am I doing something obviously wrong? How would I proceed from here to get past this error?
Upvotes: 1
Views: 511
Reputation: 6072
If you want to make use of the Sheets API
in Apps Script you will have to make use of the Sheets Advanced Service.
For this you will have to go to Services +
and then add the Google Sheets API
:
Since this is an advanced service, the authorization flow will be handled by Google so you won't have to provide the clientId
and the API key
.
Upvotes: 2