Skip to main content

xlsx2csv

xlsx to csv converter (http://github.com/dilshod/xlsx2csv)

Converts xlsx files to csv format. Handles large XLSX files. Fast and easy to use.

Tested (supported) Python versions:

  • 2.4
  • 2.7
  • 3.4 to 3.14

Installation:

sudo easy_install xlsx2csv

or

pip install xlsx2csv

Also works standalone with only the xlsx2csv.py script.

Usage:

 xlsx2csv.py [-h] [-v] [-a] [-c OUTPUTENCODING] [-s SHEETID]
                   [-n SHEETNAME] [-d DELIMITER] [-l LINETERMINATOR]
                   [-f DATEFORMAT] [--floatformat FLOATFORMAT]
                   [-i] [-e] [-p SHEETDELIMITER]
                   [--hyperlinks]
                   [-I INCLUDE_SHEET_PATTERN [INCLUDE_SHEET_PATTERN ...]]
                   [-E EXCLUDE_SHEET_PATTERN [EXCLUDE_SHEET_PATTERN ...]] [-m]
                   xlsxfile [outfile]

positional arguments:

  xlsxfile              xlsx file path, use '-' to read from STDIN
  outfile               output csv file path, or directory if -s 0 is specified

optional arguments:

  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -a, --all             export all sheets
  -c OUTPUTENCODING, --outputencoding OUTPUTENCODING
                        encoding of output CSV **Python 3 only** (default: utf-8)
  -s SHEETID, --sheet SHEETID
                        sheet number to convert, 0 for all
  -n SHEETNAME, --sheetname SHEETNAME
                        sheet name to convert
  -d DELIMITER, --delimiter DELIMITER
                        delimiter - column delimiter in CSV, 'tab' or 'x09'
                        for a tab (default: comma ',')
  -l LINETERMINATOR, --lineterminator LINETERMINATOR
                        line terminator - line terminator in CSV, '\n' '\r\n'
                        or '\r' (default: os.linesep)
  -f DATEFORMAT, --dateformat DATEFORMAT
                        override date/time format (ex. %Y/%m/%d)
  --floatformat FLOATFORMAT
                        override float format (ex. %.15f)
  -i, --ignoreempty     skip empty lines
  -e, --escape          escape \r\n\t characters
  -p SHEETDELIMITER, --sheetdelimiter SHEETDELIMITER
                        sheet delimiter used to separate sheets, pass '' if
                        you do not need a delimiter, or 'x07' or '\\f' for form
                        feed (default: '--------')
  -q QUOTING, --quoting QUOTING
                        field quoting, 'none' 'minimal' 'nonnumeric' or 'all' (default: 'minimal')
  --hyperlinks, --hyperlinks
                        include hyperlinks
  -I INCLUDE_SHEET_PATTERN [INCLUDE_SHEET_PATTERN ...], --include_sheet_pattern INCLUDE_SHEET_PATTERN [INCLUDE_SHEET_PATTERN ...]
                        only include sheets with names matching the given pattern, only
                        affects when -a option is enabled.
  -E EXCLUDE_SHEET_PATTERN [EXCLUDE_SHEET_PATTERN ...], --exclude_sheet_pattern EXCLUDE_SHEET_PATTERN [EXCLUDE_SHEET_PATTERN ...]
                        exclude sheets with names matching the given pattern, only
                        affects when -a option is enabled.
  -m, --merge-cells     merge cells

Usage with a folder containing multiple xlsx files:

    python xlsx2csv.py /path/to/input/dir /path/to/output/dir

will output each file in the input directory converted to .csv in the output directory. If omitting the output directory, it will output the converted files in the input directory.

Usage from within Python:

  from xlsx2csv import Xlsx2csv

  # Recommended: using context manager for proper resource cleanup
  with Xlsx2csv("myfile.xlsx", outputencoding="utf-8") as xlsx2csv:
      xlsx2csv.convert("myfile.csv")

  # Simple usage (but may cause ResourceWarning in modern Python)
  Xlsx2csv("myfile.xlsx", outputencoding="utf-8").convert("myfile.csv")

Expat SAX parser is used for XML parsing.

See alternatives:

Perl:

https://metacpan.org/dist/Spreadsheet-Read/view/scripts/xlsx2csv

Bash: http://kirk.webfinish.com/?p=91

Python: http://github.com/staale/python-xlsx http://github.com/leegao/pyXLSX

Ruby: http://roo.rubyforge.org/

Java: http://poi.apache.org/

Meta

Dilshod Temirkhdojaev – tdilshod@gmail.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/dilshod

Metadata

Release files for xlsx2csv 0.8.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xlsx2csv 0.8.7
File Size Uploaded Provenance Actions
xlsx2csv-0.8.7.tar.gz 251.2 kB With provenance Details for xlsx2csv-0.8.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xlsx2csv 0.8.7
File Interpreter ABI Platform Actions
xlsx2csv-0.8.7-py3-none-any.whl Python 3 none any Details for xlsx2csv-0.8.7-py3-none-any.whl

Total release size: 269.3 kB

Release files / xlsx2csv-0.8.7.tar.gz

Download URL xlsx2csv-0.8.7.tar.gz
Size 251.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f109dd95565e015cf8f430f4a37fd371f4ffb38a956a3f969bc3d5325593afde
BLAKE2b-256 checksum
How to use checksums
074ef24b986c90ca9c92898e49d9185784e3269f549bb1a321256cf7f4a58cb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / xlsx2csv-0.8.7-py3-none-any.whl

Download URL xlsx2csv-0.8.7-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0791ec6027643479e910e921904ee42914edb735f2406a8af7caff9521c11a4c
BLAKE2b-256 checksum
How to use checksums
719e0991398ab22a2bdfedf0b724c0274cbdf4188e3cd42e068c21015a2a3fe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for xlsx2csv 0.8.7

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xlsx2csv-0.8.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

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