WolfDocx - table cell edits
Update table cells in an existing Word document with Python
Change the approved numbers in a memo's table and leave everything else in the .docx alone. WolfDocx lists the cells it can safely edit, binds each edit to the exact source file and the cell's current text, and writes a new output file only when every edit verifies.
Update one cell, bound to the source
from wolfdocx.reporting import author_report, discover_report_targets, parse_report_request
found = discover_report_targets("board_memo.docx")
revenue = next(
t for t in found["targets"]
if t["kind"] == "cell" and t["target"] == {"table": 1, "row": 2, "cell": 2}
)
report = author_report(parse_report_request({
"source": "board_memo.docx",
"destination": "board_memo_final.docx",
"source_sha256": found["source_sha256"],
"edits": [{**revenue, "text": "7,500"}],
}))
assert report.passed, report.codeTable, row, and cell coordinates start at one. discover_report_targetsreturns each editable cell's current text and a structure fingerprint; if the source file or that cell has changed since discovery, author_report refuses with a code such as expected_old_text_mismatch and writes nothing. One request can carry several cell and text edits, applied together or not at all.
When to use WolfDocx and when to use python-docx
- Use WolfDocx when the document is a reviewed deliverable and a pipeline may only change specific approved values, with a refusal instead of a partial write when anything is unexpected.
- Use python-docx when you build documents from code or need general read and write access to paragraphs, tables, and styles.
Limitations
- Discovery lists only cells whose text sits in one simple run.
- Cells that intersect fields, tracked revisions, comments, content controls, or other unsupported inline structures are refused.
- Header and footer tables require naming the exact header or footer part.
- WolfDocx does not lay out pages and makes no general Word compatibility promise.
Get WolfDocx
WolfDocx Commercial is an organization-scoped subscription. Commercial package access uses the authenticated distribution channel. The package credential is issued on the checkout success page after payment and can be reissued through https://wolfxl.com/recover. There is no public free package.
Review the scoped before-and-after memo files in the reporting walkthrough, or ask about your document before purchasing if compatibility is uncertain.