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

Storing/Using sheet name when reading excel #756

Closed
R1j1t opened this issue Feb 13, 2020 · 3 comments · Fixed by #758
Closed

Storing/Using sheet name when reading excel #756

R1j1t opened this issue Feb 13, 2020 · 3 comments · Fixed by #758

Comments

@R1j1t
Copy link
Contributor

R1j1t commented Feb 13, 2020

At present (0.37.3), when we read excel the name associated with table object is the file name. Can we change this behavior and instead save the sheet name (atleast when reading multi sheet excel)?

I had a use case to search by sheet name and had to make changes in the current XlsxReader for this.

Current

 book1.xlsx  
 A  |   B   |
-------------
 1  |   56  |
 2  |   78  |
 3  |  100  |
 4  |  122  |
 5  |  144  |
 6  |  166  |

 book1.xlsx 
 C  |  D   |
------------
 4  |  12  |
 5  |  32  |
 6  |  52  |
 7  |  72  |

Proposed

 sheet1
 A  |   B   |
-------------
 1  |   56  |
 2  |   78  |
 3  |  100  |
 4  |  122  |
 5  |  144  |
 6  |  166  |

 sheet2 
 C  |  D   |
------------
 4  |  12  |
 5  |  32  |
 6  |  52  |
 7  |  72  |
@benmccann
Copy link
Collaborator

This seems reasonable to me. What do you think @hallvard ?

@hallvard
Copy link
Contributor

I think the reason I did it this way, was because the table name was used as a label in a UI. In that case the name of the file was more meaningful than the sheet name, particularly in a UI showing tables from several files. But in general, I agree that the sheet name may be better, and in the UI case you usually have access to the file name and can still use that as the label. The opposite is not the case, if you don't store the sheet name as the table's name, it's difficult to access it.

So I support the change. You could introduce a loading option that allowed to choose or even provide a pattern that could combine then, e.g. into book.xlsx#sheet1, but I don't think that should be introduced without someone asking for it (later).

@R1j1t
Copy link
Contributor Author

R1j1t commented Feb 14, 2020

Sure, let me complete it and create a pull request by sunday

@R1j1t R1j1t mentioned this issue Feb 14, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants