docx-mailmerge
Performs a Mail Merge on docx (Microsoft Office Word) files
What it is and what it does
docx-mailmerge is a Python library that automates filling Microsoft Word templates by replacing merge fields with values you supply. It reads docx files, identifies merge fields defined in the template, and substitutes them with provided data—all without needing Microsoft Office installed. The library supports simple field replacement, dynamic table row generation from lists of dictionaries, and template duplication with page breaks for bulk document creation.
The package has no runtime dependencies, making it lightweight to install. However, it has been archived and unmaintained since 2019. While it remains functional for basic mail merge tasks, you should be aware that it will not receive updates for compatibility with newer Python versions or changes to the docx specification.
Use it for:
- Generate personalized letters or documents by merging customer data into a template
- Create bulk invoices or reports by populating templates with rows of tabular data
- Automate document generation in a web application without deploying Microsoft Office on the server
- Build dynamic table contents in docx files by supplying lists of dictionaries as row data
- Produce multiple document copies from a single template with different field values for each
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Performs mail merge operations on docx files by replacing merge fields with supplied values, without requiring Microsoft Office to be installed.
Yes, if you need basic mail merge for docx files and can work within its documented scope. The permissive MIT license and zero runtime dependencies make it low-friction to add. However, the abandoned status means no bug fixes or compatibility updates will arrive—test thoroughly with your target Python version and docx complexity before relying on it in production.
Install
docx-mailmerge on PyPI
pip
pip install docx-mailmergeuv
uv add docx-mailmergepoetry
poetry add docx-mailmergeInstalling docx-mailmerge
Before you install
Installation is straightforward with no runtime dependencies. However, the project is archived and the last release was in 2019, indicating the package is no longer actively maintained.
License in practice
Licensed under MIT (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install docx-mailmerge
from mailmerge import MailMerge
with MailMerge('input.docx') as document:
document.merge(field1='value1', field2='value2')
document.write('output.docx')
Verify before relying
- Whether the package works reliably with Python versions beyond 3.4 as declared in classifiers
- Whether merge operations handle complex docx structures beyond documented basic field and row merging
- Current compatibility with recent versions of the Office Open XML format
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,501 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 215,027/month — #9,407 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docx_mailmerge-0.5.0-py2.py3-none-any.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
docx-mailmerge2Performs mail merge operations on docx files by…
permissive · top 15,000 on PyPI
docxtplGenerates Word documents (.docx) from templates…
copyleft · top 5,000 on PyPI
docxcomposeConcatenates and merges multiple Microsoft Word…
permissive · top 5,000 on PyPI
docxCreates, reads, and writes Microsoft Office…
unclear · top 15,000 on PyPI
python-docxpython-docx reads, creates, and modifies…
permissive · top 1,000 on PyPI
doc2docxConverts legacy .doc files to modern .docx…
permissive · top 15,000 on PyPI
python-docx-ml6Reads, creates, and updates Microsoft Word…
permissive · top 15,000 on PyPI
docx2pdfConverts DOCX files to PDF on Windows or macOS…
permissive · top 5,000 on PyPI
aspose-wordsAspose.Words for Python is a document…
unclear · top 15,000 on PyPI
htmldocxConverts HTML content into Microsoft Word…
permissive · top 5,000 on PyPI