-
Notifications
You must be signed in to change notification settings - Fork 949
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
add get_notes
#1451
add get_notes
#1451
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nbwzx thank you for this feature this is realy nice !
I have a few comments on how you solve this issue. once solved we can merge it.
I have updated based on your suggestions. Thanks for your detailed comments! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried it, works like a charm, what is left to do:
- documentation
- typing
then we can merge.
I have added the documentation and typing, thanks. |
Thank you for the feature. Please rebase your code on the master branch then we can run the CI to check/test your code. |
Unfortunately, tox cannot be installed on my computer because of the dependency conflicts. I have fixed the missing typing from the workflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great thank you for this contribution.
I think a test should have been added before merging this PR. My apologies for not suggesting this sooner, but I did not expect it to be merged when it was, so I did not comment yet. :) I have made such a test in the This function also raises a question of default behaviour: should non-square arrays are unexpected from users. See #1289 & #1305 for much more information on this, but effectively, which of the following structures should a user expect? [
["top left note", None],
[None, "bottom right note"],
] [
["top left note"],
[None, "bottom right note"],
] Whichever we think makes the most sense should be represented in a test, so that behaviour is maintained. Finally, I think this is very wordy
and would better be represented with an example like provided above. As @lavigne958 says, thank you for the work on this ! :) |
Yeah, that's pretty good.
I think a square array would be better after I reading your links. Also, it makes the output of get_values and get_notes correspond to each other, which is I expected. By the way, shall we add some parameters of get_values into get_notes, e.g. range_name, maintain_size? |
Technically, for historical reasons both cases (square and not) are "default". See #1296 (comment) for context, but effectively,
and print("worksheet.get")
print(worksheet.get("A1:B2"))
print("worksheet.get_values")
print(worksheet.get_values("A1:B2")) you get
So... I am not sure which default this function should have, or whether it should have
I don't think so, because adding utilities and kwargs makes things complicated and hard to maintain. For example, I do think if there are no notes, Run print(worksheet.get_notes())
print(worksheet.get("H2:I3")) on an empty sheet to get
(I say this also partly because the above |
Thank you for the explanation.
You have already finished (1) in test/get-notes, I don't know how can I help with others since it is a merged pr. Shall I open a new pr or is it convenient for you to update them? |
if you'd like to contribute, you can pull the branch with the test and make a new PR. Thanks for the enthusiasm! |
Hi when using gspread most data you get is in a matrix format (or a single list format when requesting a single row) so the general usage is to iterate over a matrix. Iteration over a dict is not standard, the only method providing a In this way we agree to return a matrix (list of list). |
I think get_notes would be more useful if if could be applied to a range. |
Hi @twosheds, thanks for the suggestion! Since this PR is closed, could you instead open an issue? thanks |
get_note can only get the content of the note located at one cell, we need get_notes to get all notes in the sheet