docx2csv
Extracts tables from .docx files and saves them as CSV, TSV, XLSX, or JSON.
Installation
pip install docx2csv
For XLS (Excel 97) output support:
pip install docx2csv[xls]
Quick Start
Command Line
# Extract all tables as separate CSV files
docx2csv extract document.docx
# Extract as XLSX
docx2csv extract document.docx --format xlsx
# Extract as single CSV file with all tables
docx2csv extract document.docx --format csv --singlefile
# Filter tables by minimum row count
docx2csv extract document.docx --sizefilter 3
# Specify output location
docx2csv extract document.docx --output results.csv
# Analyze a document (list tables without extracting)
docx2csv analyze document.docx
Python API
from docx2csv import extract_tables, extract, analyze
# Get table data as Python objects
tables = extract_tables('document.docx')
for table in tables:
print(f"Table {table['id']}: {table['num_rows']} rows x {table['num_cols']} cols")
for row in table['data']:
print(row)
# Extract to file
extract('document.docx', format='xlsx', output='output.xlsx')
# Analyze document structure
info = analyze('document.docx')
Output Formats
| Format | Extension | Description |
|---|---|---|
| CSV | .csv |
Comma-separated values |
| TSV | .tsv |
Tab-separated values |
| XLSX | .xlsx |
Excel 2007+ (via openpyxl) |
| XLS | .xls |
Excel 97 (requires pip install docx2csv[xls]) |
| JSON | .json |
Structured JSON with metadata |
Requirements
Contributing
Contributions are welcome! Every little bit helps.
- Fork the repo on GitHub
- Clone your fork:
git clone https://github.com/your-username/docx2csv.git - Create a branch:
git checkout -b name-of-your-bugfix-or-feature - Make your changes and add tests
- Run tests:
pytest - Commit and push:
git commit -m "Your message" && git push origin your-branch - Submit a pull request
Credits
- Ivan Begtin - Author and maintainer
- Vsevolod Oparin - Optimized table extraction code
License
BSD 3-Clause License. See LICENSE for details.
Metadata
Release files for docx2csv 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| docx2csv-0.1.4.tar.gz | 9.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| docx2csv-0.1.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.4 kB
Release files / docx2csv-0.1.4.tar.gz
| Download URL | docx2csv-0.1.4.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
501fd0dd2041dc5dec1f1e27222d7230a41d253b9b1617d2bf5cf4c99f2583e6
|
|
BLAKE2b-256 checksum How to use checksums |
6617d39191ba2795bd444c08ed9fb6fb1194e3867081b06f9672ef660da8b1f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / docx2csv-0.1.4-py2.py3-none-any.whl
| Download URL | docx2csv-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
241342b445e3d93202efe34b66fc54cc8a0242dd060e001fe2520a881f13acb6
|
|
BLAKE2b-256 checksum How to use checksums |
44183504efd3d20899639760c806d6e2914d0a93e48c8141140a4b4379bf0a8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for docx2csv 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.