We have a google spreadsheet with a sheet named something like foo + bar (yay). When I try to select data from the sheet using the Java API, I'm getting back an error from Google saying:
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Unable to parse range: foo bar (yay)!A2:Z",
"reason" : "badRequest"
} ],
"message" : "Unable to parse range: foo bar (yay)!A2:Z",
"status" : "INVALID_ARGUMENT"
}
The code looks something like this (some details of authentication elided, and translated from Scala)
Sheets s = ... // constructed using HTTP transport & credentials
String range = "'foo + bar (yay)'!A2:Z";
String spreadsheetId = ... // fill in your own
ValueRange values = s.spreadsheets().values().get(spreadsheetId, range).execute();
It's based on the following code example: https://developers.google.com/sheets/api/quickstart/java#step_3_set_up_the_sample
Notice that the + has been replaced by a single space , as if it were being URL encoded. I tried replacing + with %2B but I still get an error and it repeats %2B back to me as if I meant literally "%2B" - so I don't think it's a matter of URL encoding.
I tried listing the sheet names for this spreadsheet, and I'm getting back a + sign in the sheet name, so I don't think that's the problem. Then I tried renaming the sheet to use the word "and" instead of +, and my code was able to successfully select the range - thus I'm pretty certain the + is the problem. I don't see any description of escaping special characters in the documentation.
I noticed this in the documentation: https://developers.google.com/sheets/api/guides/concepts#a1_notation and tried surrounding the sheet name with single quotes ("'foo + bar (yay)'") but to no avail.
Is there any way I can select this range without renaming the sheet?