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

get_all_records retrieves a large number of empty rows after the end of the data #1363

Closed
timmc-edx opened this issue Dec 5, 2023 · 3 comments · Fixed by #1364
Closed

get_all_records retrieves a large number of empty rows after the end of the data #1363

timmc-edx opened this issue Dec 5, 2023 · 3 comments · Fixed by #1364
Assignees
Labels

Comments

@timmc-edx
Copy link

timmc-edx commented Dec 5, 2023

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
@alifeee
Copy link
Collaborator

alifeee commented Dec 5, 2023

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

@timmc-edx
Copy link
Author

Yes, that does appear to fix it!

@alifeee
Copy link
Collaborator

alifeee commented Dec 7, 2023

Hi. Please read the proposal for changing how get_all_records works for next release 6.0.0 -> #1367. We would enjoy if you would contribute your opinion :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants