Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding of Sheet Names with "+" Sign #20415

Open
ashokkumarrathore opened this issue Apr 3, 2024 · 1 comment
Open

Encoding of Sheet Names with "+" Sign #20415

ashokkumarrathore opened this issue Apr 3, 2024 · 1 comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ashokkumarrathore
Copy link

ashokkumarrathore commented Apr 3, 2024

It pertains to the encoding of sheet names containing a plus sign ("+"). When making API calls to retrieve data from a spreadsheet, if the sheet name includes a plus sign, such as in the example "Users+", the plus sign is being incorrectly encoded, resulting in unexpected behavior. Specifically, the plus sign is being replaced with a space in the URL's range property.

Here's an example of the request URL and the accompanying error:
GET https://sheets.googleapis.com/v4/spreadsheets/1SnJxI2ExTpCCumlHQhWdgTtsknbZsD9hYlMFnK-jmKc/values/Users+!1:101?valueRenderOption=FORMATTED_VALUE

Error:

{
  "code": 400,
  "errors": [
    {
      "domain": "global",
      "message": "Unable to parse range: Users !1:101",
      "reason": "badRequest"
    }
  ],
  "message": "Unable to parse range: Users !1:101",
  "status": "INVALID_ARGUMENT"
}

Furthermore, even if I attempt to manually encode the plus sign in the range formula as "%2B" (e.g., Users%2B!1:101), the Java library's behavior results in double encoding, producing "Users%252b!1:101", where the percent sign is also encoded to "%25". This issue hinders the proper functioning of the API calls, as the encoded sheet name does not match the actual sheet name in the spreadsheet, leading to errors in processing.

More details here : https://issuetracker.google.com/issues/322267497

@diegomarquezp diegomarquezp added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 5, 2024
@diegomarquezp
Copy link
Contributor

Hi @ashokkumarrathore, thanks for bringing this up. Would you mind sharing a small reproducing snippet that causes this error? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants