-
Notifications
You must be signed in to change notification settings - Fork 934
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
[feature] Add 'expand_table' feature #1475
base: master
Are you sure you want to change the base?
Conversation
Add a new feature that allows a user to expand a cell range into a table. the expand will look for the right most cell with adjacent value. the expand will look for the bottom most cell with adjacent value. the expand will table down from top left celle range to bottom right value. closes #1414 Signed-off-by: Alexandre Lavigne <[email protected]>
3df98d7
to
93ffc1e
Compare
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.
this is a nice self-contained change. good work here :)
I think we need more tests, as I foresee a lot of edge cases, and it would be good to catch those before the feature is in gspread.
For example, what is the expectation for expanding this table from the top left?
1 | 1 | - | 1 |
---|---|---|---|
1 | 1 | 1 | 1 |
- | - | 1 | - |
1 | 1 | 1 | 1 |
This is not clear to me. Also the internal (private) utils
expanding functions are unclear what they do.
As well, we should have a utils
test and a worksheet
test. Currently there is only utils
I thought about it and I thought:
I would expect something like:
| 1 | 1 |
| 1 | 1 |
so far the method in |
I think a reasonable implementation is "the same as what happens when you CTRL+RIGHT and CTRL+DOWN", i.e., to stop just before empty cells. As for whether that is what other people will expect... that's another question... if people think it should work a certain way, they may think there is a bug... which is why very clear docstrings are good
wait, huh? why are we ignoring the headers? the function should just return a I will look back at the code now :) |
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.
you are doing good work on this change :)
I have left some comments. I am a little worried that a new feature will result in something we do not consider, causing errors. But I think we will be ok now.
thanks!!!
I have added some new tests. In particular, they are "what should happen" tests. They are: 1 - missing header item values = [
["A1", "", "C1", ""],
["A2", "B2", "C2", ""],
["A3", "B3", "C3", ""],
["", "", "", ""],
]
expected_table = [
["A1"],
["A2"],
["A3"],
] 2 - missing initial cell values = [
["", "B1", "C1", ""],
["A2", "B2", "C2", ""],
["A3", "B3", "C3", ""],
["", "", "", ""],
]
expected_table = [
["", "B1", "C1"],
["A2", "B2", "C2"],
["A3", "B3", "C3"],
] 3 - missing first column item values = [
["A1", "B1", "C1", ""],
["", "B2", "C2", ""],
["A3", "B3", "C3", ""],
["", "", "", ""],
]
expected_table = [
["A1", "B1", "C1"],
["", "B2", "C2"],
["A3", "B3", "C3"],
] 4 - missing last column item values = [
["A1", "B1", "C1", ""],
["A2", "B2", "", ""],
["A3", "B3", "C3", ""],
["", "", "", ""],
]
expected_table = [
["A1", "B1", "C1"],
] Conc.Are these what you expect? Personally I might want case 4 to end up in the entire table, as I reckon I am more likely to have a full first column, and empty gaps in the final column. However, if I use the I am ready to merge this 👍. However, we should also add it to the list of examples and documentation somewhere. |
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.
include in examples docs. otherwise approve :)
Add a new feature that allows a user to expand a cell range
into a table.
the expand will look for the right most cell with adjacent value.
the expand will look for the bottom most cell with adjacent value.
the expand will table down from top left celle range to bottom right
value.
closes #1414
Signed-off-by: Alexandre Lavigne [email protected]