0
votes

I have a Google Spreadsheet which is shared as "Anyone with the link can EDIT". I want to perform a PUT request to edit this document using the Google Sheets API v4. Ideally, I wish to do this using only an API key and not using OAuth2, since authenticating with Google using OAuth is a pain to get working on Xamarin. Also, this would require the user to enter a password every hour, which would break usability.

Supposedly, requests for public data can be sent using only the API key in the request, not requiring OAuth. This works for GET requests, but I get a 401 response when doing this for the PUT request. (This unintentionally failed for GET requests before, which leads me to believe that this should work for PUT requests as well, as long as the target document is publicly shared).

GET https://sheets.googleapis.com/v4/spreadsheets/{sheetId}/values/Sheet1%21A1%3AJ1?key={myKey} HTTP/1.1 

...works, but

PUT https://sheets.googleapis.com/v4/spreadsheets/{sheetId}/values/Sheet1%21A1%3AJ1?key={myKey} HTTP/1.1 

...yields a 401 Unauthorized.

Is anyone able to shed some light on whether or not this should be possible, or how to work around it?

1

1 Answers

2
votes

Anonymous writes using the APi are not allowed (they currently require credentials), even if the sheet is shared as 'anyone can edit'.