Download
=PYTHON(report.xlsm) macros kept
For Python developers

Edit Excel files from Python — with the macros still there.

One package opens, edits, recalculates and saves .xlsx and .xlsm, reads .docx and adds slides to .pptx. The SumSheet, SumDoc and SumSlide cores ship inside the wheel: nothing compiles on install, no Microsoft Office or LibreOffice needed. Your file never leaves your machine.

Install

The package is on PyPI: pypi.org/project/sumoffice.

pip install sumoffice

Wheels for macOS (Apple silicon and Intel), Linux x86-64 and aarch64 (glibc 2.28 or newer) and Windows x64, Python 3.10 and newer. Each wheel is under 50 MB.

First result in five lines

Sample files for the examples: report.xlsm, budget.xlsm, model.xlsx, contract.docx, deck.pptx — or all at once: curl -O https://sumoffice.com/samples/report.xlsm -O https://sumoffice.com/samples/budget.xlsm -O https://sumoffice.com/samples/model.xlsx -O https://sumoffice.com/samples/contract.docx -O https://sumoffice.com/samples/deck.pptx (on Windows: curl.exe). Your own files work too.

import sumoffice wb = sumoffice.open("report.xlsm") wb["Cash flow"]["B7"] = 42 wb.save("report-edited.xlsm")

The VBA project, Power Query parts and images stay in the saved file byte for byte; the package never rewrites parts it did not change.

Three examples

1. Change a cell in a macro workbook and keep the macros.

wb = sumoffice.open("budget.xlsm") print(wb.sheet_names) # ('Cash flow', 'Summary') wb["Cash flow"]["B7"] = 42 # number, text, None, or "=B5*2" wb.save("budget-edited.xlsm") # vbaProject.bin is kept as it was

2. Recalculate and read the results back.

wb = sumoffice.open("model.xlsx") sheet = wb["Summary"] sheet["A1"] = 1200 sheet["A2"] = "=A1*1.2" wb.recalc() print(sheet["A2"]) # 1440 print(sheet.read("A1:B3")) # values of a range wb.save("model-edited.xlsx")

3. Read a Word document; add a slide to a deck.

print(sumoffice.text("contract.docx")) deck = sumoffice.open("deck.pptx") deck.add_slide() deck.save("deck-edited.pptx")

Use it from Claude Desktop or Cursor

The package includes a local MCP server. It works only with files on your computer, only inside your home folder by default, and never overwrites the source file: edits come back as a copy.

{ "mcpServers": { "sumoffice": { "command": "/full/path/to/venv/bin/sumoffice-mcp" } } }

Desktop apps do not read your shell's PATH: take the full path from which sumoffice-mcp (Windows: where sumoffice-mcp). Claude Desktop: Settings → Developer → Edit Config, then restart the app. Tools: open_workbook, read_range, write_cells, recalc, save_copy, document_text. Other folders: SUMOFFICE_MCP_ROOTS. For files that should open in a remote editor cabin instead, see the hosted MCP server.

What is free

Without a key30 documents per day, no expiry.
Developer key10,000 documents per day for 90 days from issue. To request one, write to hello@sumoffice.com with the subject “Developer key”. Put the key in SUMOFFICE_LICENSE, or the path to the key file in SUMOFFICE_LICENSE_FILE.
When the quota is used upLicenseQuotaError right away, with a link to this section. No waiting, no slowdown.
What countsOpening or saving a file in any of the three cores — workbooks, documents and presentations share one daily count. Edits inside an open file, however many cells you change, are not counted.
Where it is countedIn ~/.layers/sumoffice-state.json, or in SUMOFFICE_STATE_DIR when it is set. The key is looked up in this order: SUMOFFICE_LICENSE, the file named by SUMOFFICE_LICENSE_FILE, ~/.layers/license.jws. A key in that last file applies to every run on the machine, and the free 30 then do not apply; to try the free tier on such a machine, point SUMOFFICE_LICENSE_FILE at an empty file.

What it does not do

  • Run VBA macros. It keeps them, byte for byte.
  • Convert to PDF or render page images in this release: convert() and preview() raise a typed error and create no file.
  • Edit Word text through the short API. Reading is one call; editing goes through the low-level Session.
  • Embed fonts. The Word core uses system fonts; on a font-less server set FASTDOC_FONT_DIR.

When people need to see the files

The library makes and changes files inside your program. Showing them to people and letting them edit is a job for the rest of SumOffice:

  • In the browser — the SumOffice server. The files your code generates open in SumSheet, SumDoc and SumSlide editors in the browser; several people can edit at once and the result comes back as a new version. How the server works · connect it to Nextcloud, ownCloud, Seafile, Moodle, Odoo.
  • On the computer — the desktop apps. SumSheet, SumDoc and SumSlide for macOS and Windows. Download.
  • Inside your own product — SumOffice Embedded. The same editors built into your web or mobile app. SumOffice Embedded.

Made by SumOffice. Privacy · Contact

SumOffice assistant

Answers are assembled from the documentation and may be inaccurate — check the sources.