I'm trying to read the document from the cron:
https://sheets.googleapis.com/v4/spreadsheets/<sheet_id>?key=<api_key>
My document is available to anyone with the link.
My #1 key settings:
Application restrictions:
- IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
- API restrictions - none
My #2 key settings:
Application restrictions:
- IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
- API restrictions - Google Sheets API
My #3 key settings:
Application restrictions:
- IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
- API restrictions - Google Sheets API, Google Drive API
My #4 key settings:
Application restrictions:
- IP addresses (web servers, cron jobs, etc.) - none
- API restrictions - Google Sheets API
My #5 key settings:
Application restrictions:
- IP addresses (web servers, cron jobs, etc.) - none
- API restrictions - Google Sheets API, Google Drive API
My #6 key settings:
Application restrictions:
- IP addresses (web servers, cron jobs, etc.) - none
- API restrictions - none
When I try to open a document with each key, I get a 403 error:
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
The same error occurs when using the API Explorer (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get).
At the same time, the document itself opens successfully from a link from any computer and from any browser even to unauthorized users.
This problem began on July 9 at 09:35 PM (UTC+0).
Prior to this error, I successfully received data from the document using the #1 key settings
.
Update:
I found another strange nuance: on all other documents there is no such problem. An error is observed on one particular document. I compared the access settings with others - they are identical.
Update 2:
I tried to copy the table and open it via API - the error was the same. An hour later I tried again - it all worked.
Calling a REST API in Google Sheets is as easy as installing the Apipheny app, then opening the app in your Google Sheet, entering your API request, and clicking “Run”. Keep reading for instructions on how to import REST API data into Google Sheets.
After seeing HoverPhoenix comment, I change access of My sheet to ** Anyone with link** on Viewer mode.
After changing the access it is working properly. If Data security is the concern then the best option is to use OAuth 2.0 Client IDs as credentials.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With