There are a couple of packages that let you do this. Check

  1. python-docx.

  2. docx2txt (note that it does not seem to work with .doc). As per this, it seems to get more info than python-docx. From original documentation:

import docx2txt

# extract text
text = docx2txt.process("file.docx")

# extract text and write images in /tmp/img_dir
text = docx2txt.process("file.docx", "/tmp/img_dir") 
  1. textract (which works via docx2txt).

  2. Since .docx files are simply .zip files with a changed extension, this shows how to access the contents. This is a significant difference with .doc files, and the reason why some (or all) of the above do not work with .docs. In this case, you would likely have to convert doc -> docx first. antiword is an option.

Answer from sancho.s ReinstateMonicaCellio on Stack Overflow
🌐
Read the Docs
python-docx.readthedocs.io
python-docx — python-docx 1.2.0 documentation
python-docx 1.2.0 documentation » · Release v1.2.0 (Installation) python-docx is a Python library for creating and updating Microsoft Word (.docx) files. Here’s an example of what python-docx can do: Installing · Quickstart · Working with Documents · Working with Tables ·
🌐
PyPI
pypi.org › project › python-docx
python-docx · PyPI
Create, read, and update Microsoft Word .docx files. ... python-docx is a Python library for reading, creating, and updating Microsoft Word 2007+ (.docx) files.
Discussions

Python-docx authored documents
Glad you asked this. I just ran across my first python-authored Word doc yesterday. It was clearly AI-written. Had sources that are buried behind paywalls and I asked the student to produce the sources. Said that she purchased temporary access to the sources that had since expired. I said "No problem, just show me the receipts." I await a response. Can ChatGPT create a receipt? More on reddit.com
🌐 r/Professors
18
11
May 1, 2025
Read Docx files via python - Stack Overflow
Does anyone know a python library to read docx files? I have a word document that I am trying to read data from. More on stackoverflow.com
🌐 stackoverflow.com
Can Python work with old word files .doc not .docx
This stack overflow thread gives multiple solutions for converting a doc file to a docx file using the command line, so maybe one of those could be wrapped in a python subprocess call before importing the docx file. https://stackoverflow.com/q/2405417/4637427 There's also doc2docx on PyPI (requiring Word to be installed) https://pypi.org/project/doc2docx/ More on reddit.com
🌐 r/learnpython
14
0
September 26, 2024
Looking for python library that can read and write plain word .doc
textract you could also automate the doc to docx conversion within python, first - then use python's docx lib More on reddit.com
🌐 r/learnpython
20
112
July 7, 2021
🌐
GitHub
github.com › python-openxml › python-DOCX
GitHub - python-openxml/python-docx: Create and modify Word documents with Python · GitHub
python-docx is a Python library for reading, creating, and updating Microsoft Word 2007+ (.docx) files.
Author: python-openxml
🌐
Reddit
reddit.com › r/professors › python-docx authored documents
r/Professors on Reddit: Python-docx authored documents
May 1, 2025 -

Hello and commiserations,

I've been grading end of the semester projects for my freshman-level class. The project was to pick a data set of their choice, use some of the analysis tools we've learned this semester, discover two interesting things, tell me all about it. Couldn't be more stress free.

In grading they were all pretty much what I expected, except for three students. They all used vocabulary we haven't used in class, the graphs in their report were formatted differently than the ones in the Excel workbook they were required to submit, and the "conclusions" they reached from the analysis didn't match the actual analysis. For example, it would say something like "Home runs per year have been decreasing since the 1950" and the graph below that sentence doesn't match that at all.

So, of course, I'm suspicious. In my investigating, I discover that for each, their Word document indicate s it was created by python-docx and the first author is also listed as python-docx. I did some searching but all I came across was how to use a Python library to write to a Word document. I know these kids can't code in Python. I'm wondering if this is an indication that they paid someone or bought from Chegg an analysis that they recreated in Excel or if maybe this is a sign of a ChatGPT authored document?

If anyone has any insight, I'd appreciate it. I resent having to spend a bunch of time playing detective on these types of things, but I also feel an important part of teaching a freshman class is to try to catch these things and submit them. I want these students to learn this lesson, if nothing else. But if nothing else, they will learn that whatever tool they used as a shortcut (if they actually did so) is going to earn them a low grade because it gave them a crap final product.

May the force be with all of you!

🌐
Anaconda.org
anaconda.org › conda-forge › python-docx
python-docx - conda-forge | Anaconda.org
Install python-docx with Anaconda.org. Create and update Microsoft Word .docx files.
🌐
Medium
medium.com › @lukas.forst › supercharge-your-word-reports-using-python-docx-template-4e9ebfc66b9e
Dynamic Data and Tables: Powering Up Your Documents with python-docx-template | by Lukas | Medium
March 27, 2023 - Python-docx-template is an incredibly versatile tool that can help you automate and streamline the creation of Word documents, saving you time and ensuring consistency across your documents.
Find elsewhere
🌐
Fedora
packages.fedoraproject.org › pkgs › python-docx
python-docx - Fedora Packages
python-docx-doc - Documentation for python-docx · python3-docx - Create and modify Word documents with Python ·
🌐
Snyk
security.snyk.io › snyk vulnerability database › pip
python-docx | Snyk
Create, read, and update Microsoft Word .docx files. ... Published: 12 years ago Last updated: 1 years ago Latest version: 1.2.0 Latest non-vulnerable version: 1.2.0 ... Further analysis of the maintenance status of python-docx based on released PyPI versions cadence, the repository activity, and other data points determined that its maintenance is Inactive.
🌐
YouTube
youtube.com › watch
Work with Docx in Python | Python Tutorial | 2025 - YouTube
In this Python Programming Tutorial, I have explained how to work with Docx, read a Doc file, and create/write a Docs file.==================================...
Published: March 29, 2025
🌐
Reddit
reddit.com › r/learnpython › can python work with old word files .doc not .docx
r/learnpython on Reddit: Can Python work with old word files .doc not .docx
September 26, 2024 -

I need to read the contents of a .doc file and extract the text and I've found loads of solutions for .docx file but nothing for .doc.

Can Python do this, open the file get all the text?

Noob to Python so I don't know if any of the following is helpful or relevent!
I'm creating a exe that will allow someone to drag a file onto the exe.
It will be run on Windows pc but I don't know what other software may be installed.
The script will accept the file and read the contents which is going to be processed further.

🌐
Spack
packages.spack.io › package.html
py-python-docx
Contribute to Spack Packages Repository on GitHub
🌐
GitHub
github.com › elapouya › python-docx-template
GitHub - elapouya/python-docx-template: Use a docx as a jinja2 template · GitHub
python-docx-template has been created because python-docx is powerful for creating documents but not for modifying them.
Author: elapouya
🌐
Facebook
facebook.com › fb-answers › working-with-docx-files-in-python
Working With Docx Files in Python
Explore the things you love · Log into Facebook · English (US) · فارسی · العربية · Türkçe · Deutsch · Français (France) · Polski · More languages…
🌐
Read the Docs
python-docx.readthedocs.io › en › latest › api › text.html
Text-related objects — python-docx 1.2.0 documentation
NOTE: only content-types currently supported by python-docx are generated. In this version, that is text and rendered page-breaks. Drawing is included but currently only provides access to its XML element (CT_Drawing) on its ._drawing attribute.
🌐
Reddit
reddit.com › r/learnpython › looking for python library that can read and write plain word .doc
r/learnpython on Reddit: Looking for python library that can read and write plain word .doc
July 7, 2021 -

My wife has a lot of word documents (possibly hundreds) in .doc format that need to be copy and paste to a new version of the same document.

These documents are essentially electronic forms. They have 17 text fields that needed to be copied and paste from one form to another. Doing so manually would take up a lot of time.

I'm trying to automate this process to save her time but I can't find a python library that will work with just .doc format.

docx2txt is the closest thing I'm looking for but it only works with .docx format.

Another way to go about it is to convert all the .doc files to .docx but I'd rather avoid that if I can.

Any help is appreciated. Thanks.

🌐
GeeksforGeeks
geeksforgeeks.org › python › working-with-lists-python-docx-module
Working with Lists - Python .docx Module - GeeksforGeeks
July 23, 2025 - Python docx module allows users to manipulate docs by either manipulating the existing one or creating a new empty document and manipulating it. It is a powerful tool as it helps you to manipulate the document to a very large extent.
🌐
GeeksforGeeks
geeksforgeeks.org › python › working-with-documents-python-docx-module
Working with Documents - Python .docx Module - GeeksforGeeks
October 24, 2025 - Because of this structure, Word documents cannot be manipulated like plain text files. However, Python provides the python-docx module to work with .docx files programmatically.
🌐
Medium
medium.com › @HeCanThink › python-docx-a-comprehensive-guide-to-creating-and-manipulating-word-documents-in-python-a765cf4b4cb9
Python-docx: A Comprehensive Guide to Creating and Manipulating Word Documents in Python📄 | by Manoj Das | Medium
May 9, 2025 - The python-docx library was not developed by Microsoft but was created as an open-source project by individuals in the Python community to provide a way to programmatically create and manipulate .docx files.
🌐
GitHub
github.com › mikemaccana › python-docx
GitHub - mikemaccana/python-docx: Reads, queries and modifies Microsoft Word 2007/2008 docx files. · GitHub
Reads, queries and modifies Microsoft Word 2007/2008 docx files. - GitHub - mikemaccana/python-docx: Reads, queries and modifies Microsoft Word 2007/2008 docx files.
Author: mikemaccana