openpyxl formatting

openpyxl reads and writes .xlsx workbooks and lets you format them in code: fonts, fill colors, borders, number formats, column widths, frozen panes, formulas. It comes into play after the data is written, to produce a file that is ready to read.

Example

ws['A1'].font = Font(bold=True)
ws.column_dimensions['A'].width = 20

Related concepts

The whole glossary