-
Notifications
You must be signed in to change notification settings - Fork 952
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
Print keys if not unique #1158
Comments
Hi this is an interesting feature request. In the method Generally speaking, printing informations as result to the end user is not practical when developing a library as gspread is not the final, end user facing app, so we always need to return information and the app that used gspread will take care of printing it or do something with it What we can do is: add a new method to return all non uniques headers, or only the indexes of headers that are not uniques, or a map with the keys being the indexes and the value being the header. something like that could work. |
Thank you for the reply.
I didn't know that. I've never made a library before. But now that you mention it, I don't remember seeing libraries print much information before.
I think you mean I could call the method to check for non-uniques before calling |
Yes that what I mean 🙂 For this to be useful, the method should return the list of headers that are not uniques and provide the indexes for these headers so it can be used and passed to the method I still need to clarify the returned format . |
see #1436 |
agreed, this can be closed as duplicated by #1436 |
Is your feature request related to a problem? Please describe.
My problem is with
worksheet.get_all_records()
. Gspread 5.7.2.I have some large sheets that somehow acquired duplicate headers. This caused an exception because "the given 'expected_headers' are not uniques". Because I had so many headers, it was hard to find and delete the duplicates.
Describe the solution you'd like
I added a check on the sheet keys that prints any duplicates as part of the exception.
Describe alternatives you've considered
At first I added a print statement to the existing check:
The text was updated successfully, but these errors were encountered: