python-docx is a Python package for reading, creating, and updating Microsoft Word 2007 and later .docx documents. Further detail is in the project documentation.
Overview
python-docx lets Python programs work with modern Word documents in the Office Open XML .docx format. You can open existing files, build new ones, or change content programmatically instead of using the Word desktop app.
Typical uses include generating reports, mail-merge style output, or updating templates from data pipelines. Separate documentation covers API details and examples beyond the brief install and sample notes bundled with the package.
Install it as a Python dependency in whichever environment already runs your scripts or applications.
Key features
- Read .docx files
- Create new Word documents
- Update existing documents
- Word 2007+ format support
- Python API
Use cases
- Automated report generation
- Filling document templates
- Batch updating Word files
- Server-side document output