Reputation: 4344
I am posting the following (incomplete code) to Google sheets batch update values:
{"valueInputOption":"USER_ENTERED","data":[{"range":"'Home Sheet'!B2:B2","values":[
And for some reason I am getting:
{
"error": {
"code": 400,
"message": "Invalid data[0]: Unable to parse range: 'Home Sheet'!B2:B2",
"status": "INVALID_ARGUMENT"
}
}
However if you refer to https://developers.google.com/sheets/api/guides/concepts this clearly looks like the range is valid. Interestingly this is only in the Javascript not if I use the PHP sdk.
Upvotes: 0
Views: 8366
Reputation: 45
When accessing a public sheet via URL like this:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetID}/values/{sheetName}?key={API Key}
I have to replace the space in the sheet name with %20, or remove the space from the sheet name if possible. Like this:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetID}/values/Home%20Sheet!B2:B2?key={API Key}
So this works for me so long as the sheet sharing is set to "Anyone with the link can view."
See this answer for more detailed info.
Upvotes: 3