In the googlesheets4
package, you can simply use gs4_deauth()
at the beginning of a code block to read in a sheet which has been set to openable by "anyone with link".
Not including gs4_deauth()
will mean you need to authenticate your google account before working with the sheet, which is not good for automation.
My Google sheet is set up such that anyone with the link has viewing and editing privelages. However, I still can't get append_sheet
to work without returning the following error, even though I've used gs4_deauth()
:
Error in `gargle_abort_request_failed()`:
! Client error: (401) UNAUTHENTICATED
• Request not authenticated due to missing, invalid, or expired OAuth
token.
• API keys are not supported by this API. Expected OAuth2 access token or
other authentication credentials that assert a principal. See
https://cloud.google.com/docs/authentication
Error details:
• reason: CREDENTIALS_MISSING
• domain: googleapis.com
• metadata.service: sheets.googleapis.com
• metadata.method:
google.apps.sheets.v4.SpreadsheetsService.BatchUpdateSpreadsheet