skillfed

docx-mailmerge

Performs a Mail Merge on docx (Microsoft Office Word) files

docx-mailmerge v0.5.0 215.0K downloads/30d#9,407 on PyPI274
Permissive license MIT Abandoned released

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-mailmerge

uv

uv add docx-mailmerge

poetry

poetry add docx-mailmerge

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Topic :: Text Processing

Tags

mail merge docx pythonword document template mergedocx field replacementbulk document generationword template automationmerge fields docxdocument template filling
document-automationarchived

More Text Processing packages