Skip to content

Conversation

@jarent-nvidia
Copy link
Contributor

@jarent-nvidia jarent-nvidia commented Nov 5, 2025

Description of the change:
Added boolean 'autofilter' optional argument to 'DataFrame.to_excel' function to add automatic filters to all columns in the exported excel files. As discussed with @WillAyd starting simple by allowing to add filters only to all or none columns.
New option supported by 'xlsxwriter' and 'openpyxl' engines.

@jarent-nvidia jarent-nvidia marked this pull request as draft November 5, 2025 18:14
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment but overall looks like a really nice PR. @rhshadrach any thoughts?

Convert 0-based column index to Excel column name.
"""
column_name = ""
while index > 0 or not column_name:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you raise when index < 0? Also, what's the point of this being a while loop?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my while loop comment - I supposed its so you can build column references like AA, BA, etc...

So makes sense, but still in need of a cleanup here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WillAyd Thanks for the feedback - input validation added.

@jarent-nvidia jarent-nvidia marked this pull request as ready for review November 5, 2025 21:19
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 this pull request may close these issues.

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

2 participants