Skip to main content
A default export is a bare grid: unstyled header, columns sized to nothing in particular, nothing frozen. These options fix that, and they’re the ones worth knowing by heart.

Headers

bool
default:"False"
Bolds the first row. Verified against 0.3.1: this applies bold only, with no fill, despite the source describing it as bold plus gray.
bool
default:"True"
Whether column names are written at all. Set False when appending to a template that already has headers, or exporting data only.
If you want shaded headers, add a cell_styles entry with a fill for each header cell. styled_headers won’t do it.

Freezing and filtering

int
default:"0"
Rows that stay in place while the rest scrolls. 1 pins the header.
int
default:"0"
Same for columns. 1 pins the leftmost column, which helps when it holds names or IDs.
bool
default:"False"
Adds filter dropdowns to the header row.

Column widths

bool
default:"False"
Sizes every column to fit its contents.
dict[str, float | str]
Per-column override keyed by column name. Accepts a number in Excel character units, a pixel string such as "150px", or "auto".
The two combine. Turn on auto_width and override only the columns that need it:
auto_width reads every row to measure content, so it costs time on large frames. On a million-row export, set explicit widths instead. The project’s own guidance is to disable auto-width for speed.

Row heights

dict[int, float]
Height in points, keyed by 1-based row number.
float
Applies to every row. Excel’s own default is 15.

Header content above the data

When a report needs a title block above the table, write it with header_content and push the DataFrame down with data_start_row.
list[tuple[int, int, str]]
Tuples of (row, col, text) written before the data. Rows are 1-based, columns 0-based.
int
default:"0"
Row where the DataFrame begins. It also excludes the rows above it from auto_width measurement, so a long title doesn’t stretch column A.
Row and column indexing isn’t consistent across the API. See Conventions for the full table before you set positions.

Putting it together