# docx2python

> Extract docx headers, footers, text, footnotes, endnotes, properties, comments and images

Source: https://talira.ai/catalog/docx2python-tdeqb4ak
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [documents / office / extraction](https://talira.ai/categories/documents/office/extraction), [languages / python](https://talira.ai/categories/languages/python)
- Licence: MIT[^2][^3]
- Pricing: Free and open source[^2]
- Pricing notes: MIT licensed and free.
- Free tier: yes[^2]
- Self-hostable: yes[^1]
- Creator: Shay Hill

docx2python is a Python library that reads a .docx file and returns its content as plain Python data: the body, headers, footers, footnotes and endnotes as nested lists (tables, rows, cells, paragraphs), the document's properties, its comments and its images. Tables always come out as n×m lists, with merged cells filled in, so a Word table maps straight onto rows of data, and it also extracts checkbox and dropdown selections, math equations, paragraph styles such as Heading 1, list numbering and, optionally, basic formatting as HTML. It began as an expansion of python-docx2txt; unlike [python-docx](https://talira.ai/catalog/python-docx-tj4sn5d1.md) it doesn't build documents.

## Links

- GitHub: https://github.com/ShayHill/docx2python

## Problems it solves

- pull the answers out of a filled-in Word form, including which checkboxes were ticked and what was picked in the dropdowns
- turn the tables in a .docx into lists of rows I can load into pandas or a database
- merged cells in a Word table break my parser, so I need every row to come out with the same number of columns
- extract the footnotes, endnotes, headers and footers from Word files, not just the body text
- get all the text out of hundreds of Word documents to index them for search
- save every image embedded in a Word document to a folder with Python
- find which paragraphs in a .docx are headings so I can split the document into sections
- read the comments reviewers left in a Word document along with who wrote them and when
- convert a Word table to Markdown for an LLM prompt
- keep bold and italic formatting as HTML tags when extracting text from Word
- my placeholders like #NAME# are split across runs in the Word XML so search and replace misses them

## Features

- body, headers, footers, footnotes and endnotes as nested lists with paragraphs at depth 4
- tables always returned as n×m lists; merged cells duplicated or left empty
- Par objects with each paragraph's style, list position, runs and XML element
- checkbox and dropdown selections
- comments as (reference text, author, date, comment text)
- document properties such as creator and lastModifiedBy
- images, as bytes or saved to a folder, with placeholders in the text
- math equations
- bullets and numbered lists rendered as text with indentation
- optional HTML for bold, italic, underline, strike, sub/superscript, highlight, font size and colour
- hyperlinks as \<a href\> tags
- merges runs Word splits arbitrarily and repeated links, and exposes the XML for light edits
- supports Word's strict Open XML namespace

## Limitations

- Doesn't create Word documents: it extracts content from existing .docx files, and edits only lightly through their XML (search and replace)[^1]

## Trust

Overall: 0.23 out of 1.
Signals: backing 0.20, extensibility 0.00.

- created by Shay Hill

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [python-docx](https://talira.ai/catalog/python-docx-tj4sn5d1.md): Create and modify Word documents with Python
- [Docling](https://talira.ai/catalog/docling-7gb20naa.md): Get your documents ready for gen AI
- [Unstructured](https://talira.ai/catalog/unstructured-z2qgvev8.md): Converts PDFs, Office files, HTML and email into structured data for LLM pipelines

## Sources

[^1]: https://github.com/ShayHill/docx2python (checked 20 Nov 2026)
[^2]: https://github.com/ShayHill/docx2python/blob/master/LICENSE.txt (checked 20 Nov 2026)
[^3]: https://pypi.org/project/docx2python/ (checked 20 Nov 2026)
