-
- Notifications
You must be signed in to change notification settings - Fork 19.1k
Open
Labels
EnhancementNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
- Many users export DataFrames to Excel and then manually:
- Turn on Autofilter for the header row.
- Make the header row bold for readability.
- This is repetitive and engine-specific (xlsxwriter/openpyxl). It would be helpful if DataFrame.to_excel() could request these behaviors directly, without requiring users to post-process the file.
Feature Description
-
Add support via
engine_kwargs
to toggle header Autofilter and bold styling in to_excel() for both xlsxwriter and openpyxl engines. -
Proposed usage:
df.to_excel( "out.xlsx", engine="xlsxwriter", # or "openpyxl" engine_kwargs={ "autofilter_header": True, "header_bold": True, }, )
-
Behavior:
autofilter_header=True
: Apply an Autofilter over the header row and the written data range.header_bold=True
: Apply bold font to header row cells if they are not already styled (do not override explicitStyler
/formatting).
Alternative Solutions
Users can continue manual post-processing with xlsxwriter/openpyxl directly, but it’s repetitive, adds boilerplate, and is easy to forget.
Additional Context
No response
Metadata
Metadata
Assignees
Labels
EnhancementNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team member