Apache-2.0 · open source

xlsxedit

Surgical .xlsx editing for Python — change only what you ask for and leave styles, themes, charts, and other package parts intact.

pip install xlsxedit

The problem

You have a styled Excel report: merged headers, brand colors, a chart, maybe images. Most libraries rebuild the workbook from a Python object model, so anything that model does not know about is dropped on save. xlsxedit loads the file as an OPC package, patches targeted XML, and writes back — so templates survive.

Why xlsxedit

  • Template fidelity — charts, drawings, themes, and unknown OOXML round-trip when you do not touch them
  • Headless — no Excel app; runs on servers, CI, and cron jobs
  • Fast file I/O — direct .xlsx editing; ~20k rows/s bulk export in benchmarks
  • Search-and-replacereplace, replace_image, typed placeholders
  • Bulk exportwrite_dataframe into a designed layout with row/column styles
  • Pandas — optional engine="xlsxedit" for ExcelWriter and read_excel
  • Familiar APIWorkbook.open → mutate → save

Quick start

from xlsxedit import Workbook

wb = Workbook("invoice-template.xlsx")  # same as Workbook.open(...)
wb.replace("{client}", "Jonas Corp")
wb.replace("{amount}", 520, value_type="number")
wb.replace("{date}", "2025-08-07", value_type="date")
wb.save("invoice-filled.xlsx")

Documentation