This skill reads Microsoft Word (.docx) files in text format.
Quick Start
Basic Usage
# WSL環境でPythonスクリプトを実行
wsl python3 scripts/read_docx.py "/mnt/c/path/to/file.docx"
Save in Markdown Format
- Extract text with a script
- Save to a .md file with the Write tool
Prerequisites
The python-docx package is required:
wsl pip3 install python-docx
Usage Examples
Example 1: Read a .docx file and display its contents
User: "C:\Users\keita\repos\file.docx を読み込んで"
Assistant:
1. Windowsパスを WSL パスに変換: /mnt/c/Users/keita/repos/file.docx
2. wsl python3 scripts/read_docx.py を実行
3. 抽出されたテキストを表示
Example 2: Convert .docx to Markdown and save it
User: "申請書.docx を Markdown に変換して保存"
Assistant:
1. scripts/read_docx.py でテキスト抽出
2. Markdown形式で整形
3. Write ツールで 申請書.md に保存
4. 保存完了を報告
Workflow
Reading a Single File
- The user specifies the .docx file path
- Convert the Windows path to WSL path format (
C:\→/mnt/c/) wsl python3 scripts/read_docx.pyrun- Display or save the extracted text
Batch Processing of Multiple Files
- Search for .docx files with Glob
- Run the script on each file
- Report the results together
Script Details
The Python script is scripts/read_docx.py is located in.
Main features:
- Extraction of paragraph text
- Extraction of table data
- Error Handling
How to use:
python scripts/read_docx.py <file_path>
Limitations
- Images are not extracted
- Complex layouts are simplified
- Styles such as font information and colors are lost
- Embedded objects are not extracted
Troubleshooting
python-docx is not installed
wsl pip3 install python-docx
"No module named 'docx'" error
wsl pip3 uninstall docx
wsl pip3 install python-docx
Cannot open the file
- Check that the file path is correct (Windows → WSL path conversion)
- Check that the file is not open in another program
- Check the file access permissions
Path Conversion
Converting from a Windows path to a WSL path:
C:\Users\...→/mnt/c/Users/...D:\Projects\...→/mnt/d/Projects/...- Backslash
\to slash/convert to
Related Tools
- pandoc: When more advanced conversion is needed
- python-docx2txt: A lightweight alternative library
- mammoth: Conversion in HTML format
Version History
- v1.0.0 (2026-01-06): Initial release
- Basic text extraction functionality
- Table extraction support
- Operation in a WSL environment