Appending an "anyone with link is editor" Google sheet without auth using googlesheets4?

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

Hi @cwright1

I believe you still need to pass an API key at some point in the process to avoid having to authenticate in your browser. That way Google Sheets can still track individual editors (even though you might be anonymous).

Here's what the gs4_auth_configure() function says in the help panel:

"API key. If googlesheets4 is de-authorized via gs4_deauth() , all requests are sent with an API key in lieu of a token. See the vignette How to get your own API credentials for more. If the user does not configure these settings, internal defaults are used. gs4_oauth_app() and gs4_api_key() retrieve the currently configured OAuth app and API key, respectively."

Hope this helps!