docx
Installation
SKILL.md
Word documents
Work with .docx files in Python through execute, adding python-docx==1.2.0 to a requirements.txt in files. In a workflow step, add it to the step’s requirements.txt instead.
User uploads arrive under /3b/uploads/<id>/<file>, which every execution can read. Write output to a persistent volume, such as volumes: ["documents"] and /storage/documents/report.docx, then call showStorageFile so the user can preview and download it. Never overwrite the user’s upload: save edits as a new file, and call showStorageFile again after each change.
Reading
Walk the body in order so paragraphs and tables stay interleaved as the author wrote them:
from docx import Document
from docx.table import Table
from docx.text.paragraph import Paragraph