Skip to main content

docx2csv

Extracts tables from .docx files and saves them as CSV, TSV, XLSX, or JSON.

CI PyPI Python

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.

  1. Fork the repo on GitHub
  2. Clone your fork: git clone https://github.com/your-username/docx2csv.git
  3. Create a branch: git checkout -b name-of-your-bugfix-or-feature
  4. Make your changes and add tests
  5. Run tests: pytest
  6. Commit and push: git commit -m "Your message" && git push origin your-branch
  7. 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)

Source distribution for docx2csv 0.1.4
File Size Uploaded Provenance
docx2csv-0.1.4.tar.gz 9.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for docx2csv 0.1.4
File Interpreter ABI Platform
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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page