get_all_records retrieves a large number of empty rows after the end of the data
timmc-edx opened this issue · comments
Describe the bug
A call to get_all_records
retrieves the desired data, but also returns a large number of rows from below the data.
This is new with 5.12.2, and did not occur in 5.12.1.
To Reproduce
Data:
aaa | bbb |
---|---|
w | x |
y | z |
Running worksheet.get_all_records(expected_headers=['aaa'])
prints the following:
{'aaa': 'w', 'bbb': 'x'}
{'aaa': 'y', 'bbb': 'z'}
{'aaa': '', 'bbb': ''}
{'aaa': '', 'bbb': ''}
{'aaa': '', 'bbb': ''}
{'aaa': '', 'bbb': ''}
...993 more empty rows...
(On a larger spreadsheet, there were only about 8 of these trailing empty rows.)
Expected behavior
Only two rows should have been returned.
Environment info:
- Operating System: Debian Linux
- Python version: 3.8
- gspread version: 5.12.2
the height of a spreadsheet created on Google Sheets is by default 100.
In our tests we have to set the height. So, we did not catch this case.
get_all_records
has become a bit of a mess of a method...
anyway I have made a fix with #1364 which will come in minor release 5.12.3
Yes, that does appear to fix it!