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

Add support for reading cell values by column name #9

Open
bartkl opened this issue Aug 15, 2018 · 2 comments
Open

Add support for reading cell values by column name #9

bartkl opened this issue Aug 15, 2018 · 2 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@bartkl
Copy link
Owner

bartkl commented Aug 15, 2018

Suppose this is what your Excel sheet looks like:

1 | First name  | Last name   |
2 | Bart        | Kleijngeld  |
3 | Christian   | Bos         |

Then I would like to do something like:

Read from cell by column name  2  Last name  # returns 'Bos'

or:

Read from cell  (2, Last name)  # returns 'Bos'

These are just examples. How to implement this exactly is a matter of discussion:

  1. Start the row numbering with the first data row or the header row (since the latter is skipped, it might make sense not to count it)?
  2. Should this be a separate keyword, or should it be added as a locator strategy to Read from cell? This seems preferable, but might also be tempting in a bad way, where one so obsessively cramps everything into a single keyword that it becomes hard to maintain, read or even use.

Any ideas?

@bartkl bartkl added enhancement New feature or request question Further information is requested labels Aug 15, 2018
@frankvanderkuur
Copy link

I understand what you want to do, but I can't really find a usecase for when I would use it. A header isn't really a defined entity in Excel so I would stick to using either the coordinates (A1) or the numberindex (1,1). If a user really wants to use the header, I would advice him to read the first row and than make a mapping of those headers.

@bartkl
Copy link
Owner Author

bartkl commented Aug 22, 2018

@frankvanderkuur That's funny, I seldomly use coordinates and always have an approach based on column names. I assumed everyone did, which is always a bad idea.

You definitely have a point regarding it not being an actual Excel entity. It is, by definition, a hack based not on (presumably obvious, but nonetheless) proper technical entities, but agreement. One could therefore argue it's place is not at library level.

On the other hand, if I'm not the only user who really likes working according to this approach, I think we shouldn't have to restrict ourselves since how this works is pretty obvious.

To not harass users like you who don't want to use this it would probably be better not to extent the existing Read from cell keyword with this functionality, but to choose to add a separate one as proposed earlier. That is, if we do decide to implement this at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants