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

sheet.get_all_records() throws index error when sheet has no records #1355

Closed
s2t2 opened this issue Nov 28, 2023 · 3 comments · Fixed by #1357
Closed

sheet.get_all_records() throws index error when sheet has no records #1355

s2t2 opened this issue Nov 28, 2023 · 3 comments · Fixed by #1357
Assignees
Labels
Milestone

Comments

@s2t2
Copy link
Contributor

s2t2 commented Nov 28, 2023

Describe the bug
sheet.get_all_records() throws an index error when the sheet is blank, or even when the sheet has only a header row with the column names.

To Reproduce
Steps to reproduce the behavior:

  1. Make a blank sheet OR make a sheet with only a header row with the column names (but otherwise no records)
  2. sheet = doc.worksheet("your-sheet-name")
  3. sheet.get_all_records()

Expected behavior
The function should return an empty list, indicating there are no records.

Code example*
see reproduction above

Environment info:

  • Operating System [e.g. Linux, Windows, macOS]: mac, linux
  • Python version: 3.x
  • gspread version: various, including newest 5.12
@lavigne958
Copy link
Collaborator

Hi thank you for raising the issue.

We are currently working on this method.

We'll bring a new fix soon.

This reminds me of a special case we used to handle, it looks we don't anymore.

Well fix it and update the tests too.

@alifeee alifeee added this to the 5.12.2 milestone Nov 29, 2023
@alifeee alifeee added the Bug label Nov 29, 2023
@alifeee alifeee self-assigned this Nov 29, 2023
@lavigne958
Copy link
Collaborator

thank @alifeee for taking this issue, I saw your code and checked your branch, I wait for you PR to be ready and will provide the review ASAP.

@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
Development

Successfully merging a pull request may close this issue.

3 participants