python-docx
Create, read, and update Microsoft Word .docx files.
Decision gist · record as of 2026-08-14
Yes. python-docx is a mature, well-maintained library with low install friction, permissive licensing, no known vulnerabilities, and strong community adoption. It's the standard choice for .docx manipulation in Python. Install it if you need to read, create, or modify Word documents programmatically.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- Low friction install with only two runtime dependencies (lxml and typing_extensions).
- Actively maintained with recent commits and a large community (5695 stars), supporting modern Python versions from 3.7 onward.
License · maintenance · safety
MIT (permissive) — MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions—only requiring attribution.
last release 2025-06-16 (424 days) · last repo commit 2026-08-01 · 5,695 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 113,399,633 downloads/mo, #315 on PyPI
Alternatives
Verify before relying
pip install python-docx
from docx import Document
document = Document()
document.add_paragraph("It was a dark and stormy night.")
document.save("dark-and-stormy.docx")
document = Document("dark-and-stormy.docx")
print(document.paragraphs[0].text)- Whether the library supports all .docx features (tables, images, formatting, styles) or only a subset of the OpenXML spec.
- Performance characteristics when working with large documents or batch processing.
- Whether lxml is available as a pre-built wheel on all target platforms or requires compilation.
What it is and what it does
python-docx is a Python library that lets you work with Microsoft Word documents (.docx files) programmatically. It abstracts away the underlying XML structure of the Office Open XML format, so you can create new documents, read existing ones, and modify their content—paragraphs, text, and structure—without needing to understand or manipulate XML directly.
The library is built on two runtime dependencies: lxml for XML parsing and typing_extensions for type hints. It's actively maintained, widely used (top 1000 on PyPI), and supports modern Python versions. The API is straightforward: you instantiate a Document, add or read paragraphs and other elements, and save or load files. It's designed for developers who need to automate Word document generation or parsing as part of a larger application.
Use it for
- Generate reports or invoices as .docx files from application data or templates.
- Batch convert or extract text from existing Word documents for processing or analysis.
- Automate document creation workflows where users need editable Word files as output.
- Parse .docx files to extract structured content for integration with other systems.
- Build document templates programmatically with dynamic content insertion.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
python-docx is a mature, well-maintained library with low install friction, permissive licensing, no known vulnerabilities, and strong community adoption. It's the standard choice for .docx manipulation in Python. Install it if you need to read, create, or modify Word documents programmatically.
Install
python-docx on PyPI
Before you install
Low friction install with only two runtime dependencies (lxml and typing_extensions). Actively maintained with recent commits and a large community (5695 stars), supporting modern Python versions from 3.7 onward.
Requires Python 3.9 or later.
License in practice
MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions—only requiring attribution.
Quickstart
pip install python-docx
from docx import Document
document = Document()
document.add_paragraph("It was a dark and stormy night.")
document.save("dark-and-stormy.docx")
document = Document("dark-and-stormy.docx")
print(document.paragraphs[0].text)
Verify before relying
- Whether the library supports all .docx features (tables, images, formatting, styles) or only a subset of the OpenXML spec.
- Performance characteristics when working with large documents or batch processing.
- Whether lxml is available as a pre-built wheel on all target platforms or requires compilation.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packageslxmltyping_extensions |
| Maintenance | Actively maintained 424 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 113,399,633 / month, #315 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Office/Business :: Office SuitesTopic :: Software Development :: Libraries |
Evidence: python_docx-1.2.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “read write docx files python”
- python-docxpython-docx reads, creates, and modifies Microsoft Word 2007+ (.docx)…
- python-docx-ml6Reads, creates, and updates Microsoft Word 2007+ (.docx) files from…
- docxCreates, reads, and writes Microsoft Office Word 2007 docx files in…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also docx · python-docx-ml6 · python-pptx · docx-mailmerge · htmldocx · docx-mailmerge2 · spire-doc · html-for-docx · docx2python · aspose-words