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

ENH: adding a filter (and bold) to header when writing to excel #61194

Open
1 of 3 tasks
simonaubertbd opened this issue Mar 28, 2025 · 5 comments
Open
1 of 3 tasks

ENH: adding a filter (and bold) to header when writing to excel #61194

simonaubertbd opened this issue Mar 28, 2025 · 5 comments
Assignees
Labels
Enhancement IO Excel read_excel, to_excel

Comments

@simonaubertbd
Copy link

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

Hello,

One of the things I always do when opening an excel file is adding filter on header. Just like that

Image

Feature Description

I'm not exactly sure

Alternative Solutions

I see that as an option to to_excel function or to class ExcelWriter, not sure of what would be the best.

Additional Context

No response

@simonaubertbd simonaubertbd added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 28, 2025
@rhshadrach
Copy link
Member

Thanks for the request. Assuming all of our current engines can support this, this seems like a common desire; I'm positive here. I would recommend the argument:

autofilter: bool | list-like = False

allowing the user to control which index/columns get filters. However, we'd need to workout how this interacts with other arguments, namely startrow and mergecells.

@rhshadrach rhshadrach added IO Excel read_excel, to_excel and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 28, 2025
@janeq6
Copy link

janeq6 commented Mar 29, 2025

take

1 similar comment
@janeq6
Copy link

janeq6 commented Mar 29, 2025

take

@DhruvBShetty
Copy link
Contributor

In excel, since a filter can only be applied over a continuous range of cells, I think the argument

autofilter: bool | range = False

would be more optimal as it's more in line with how it's applied in excel and makes input validation far easier. As for merge cells, Excel isn't really designed to filter columns with merged cells.

I would recommend to not apply the autofilter if there are any merged cells if the argument is simply True, but when provided a range, to check if there any merged cells in that range of columns, if no, then apply it to that range, otherwise don't apply it and raise a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO Excel read_excel, to_excel
Projects
None yet
Development

No branches or pull requests

4 participants