I am using python 2.7 on a Raspberry Pi with version 3.0.0 of gspread.
When I use gspread's get_all_values() function, I get the following error:
File "/home/pi/DB/GSheets/GoogleSheets.py", line 121, in GetAll
listOfLists = googleSheetName.worksheet(GSTabName).get_all_values()
File "/home/pi/.local/lib/python2.7/site-packages/gspread/models.py", line 444, in get_all_values
data = self.spreadsheet.values_get(self.title)
File "/home/pi/.local/lib/python2.7/site-packages/gspread/models.py", line 110, in values_get
r = self.client.request('get', url, params=params)
File "/home/pi/.local/lib/python2.7/site-packages/gspread/client.py", line 79, in request
raise APIError(response)
gspread.exceptions.APIError: {
"error": {
"code": 400,
"message": "Range ('name'!name) exceeds grid limits. Max rows: 52, max columns: 17",
"status": "INVALID_ARGUMENT"
}
}
This issue did not occur for me in a previous version of gspread. The current version, previously known as "v4", seems to have introduced this. As far as I can tell, the get_all_values function has not changed between the two versions. Does anyone know what might be causing this suddenly?
Thanks in advance!
EDIT:
'name' is being used as a placeholder for the worksheet's name.
EDIT2:
Note: I have connected the project to a completely new Google Sheet with identical worksheets (and names) and the error still occurs. All of the worksheet names are alphanumeric and contain no spaces or special characters.
EDIT3:
The name of the tab that it gets stuck on is in the form of "ABC1", but this is the first tab that gets read.
After changing it to "SheetA", if response.ok:
in client.py succeeds 4 times and then MySQLdb crashes due to an SQL syntax error in its own distribution files (likely caused by bad data being used to build a command). Before changing the tab name to be "SheetA", response.ok would succeed 3 times and then fail. When I force the exception to not be thrown, the data sent (a list of lists containing the worksheet values) is no different than what is sent when the exception is not triggered.
The actual dimension of the worksheet are 52 x 17 (rows x columns). The dimensions in the APIError always match the dimensions of the worksheet.
EDIT4:
This has been discovered: The following worksheet (tab) name formats throw an APIError (code 400): "ABC1", "ABC123", however "ABCD123" or "ABC1D" work. I also noticed that when I move a worksheet/tab with a valid name (Called FirstSheet below) before a worksheet with a non-valid name that the error thrown includes the FirstSheet name like this: read.exceptions.APIError: { "error": { "code": 400, "message": "Range (FirstSheet!ABC123) exceeds grid limits. Max rows: 132, max columns: 17", "status": "INVALID_ARGUMENT" }
, but only upon crashing at the non-valid name. The previous, valid, worksheets are read without issue.
The worksheets all vary in size.
data = self.spreadsheet.values_get(self.title)
) my first guess was that something could be wrong with it. It's really hard to track the problem when you only have a partial view of the context. Can you at least mock the name of the worksheet/tab as you did with the spreadsheet name? Is there anything suspicious about it? Try to rename it toSheetA
and see if the problem goes away. Also, can you share the actuall dimensions of the worksheet? – Seriesclient.py
file it is importing V2 from.urls
, not V4. I don't know if that is of significance or not. Also, on a previous Pi I was working on my installation of gspread had av4
folder that__init__.py
was using for Client and I was able to solve the issue I'm currently having by changing it to the Client class (inclient.py
) found outside ofv4
. The release this Pi has is not the same, so I was unable to use that solution. It seems something has changed in gspread – Waitread.exceptions.APIError: { "error": { "code": 400, "message": "Range (FirstSheet!ABC123) exceeds grid limits. Max rows: 132, max columns: 17", "status": "INVALID_ARGUMENT" }
Both worksheets are of different sizes – Wait