Skip to main content

excel2txt

Convert Excel files to delimited text

Synopsis

For usage, run excel2txt --help:

usage: excel2txt [-h] [-o str] [-d str] [-D] [-n] [--version] FILE [FILE ...]

Convert Excel files to delimited text

positional arguments:
  FILE                  Input Excel file(s)

optional arguments:
  -h, --help            show this help message and exit
  -o str, --outdir str  Output directory (default:
                        /Users/kyclark/work/python/excel2txt-py)
  -d str, --delimiter str
                        Delimiter for output file (default: )
  -D, --mkdirs          Create separate directories for output files (default:
                        False)
  -n, --normalize       Normalize headers (default: False)
  --version             show program's version number and exit

Given one or more Excel files as positional parameters, the program will create an output text file in the given output directory (which defaults to the current working directory).

For example:

$ excel2txt tests/test1.xlsx
  1: tests/test1.xlsx
Done, see output in "/Users/kyclark/work/python/excel2txt-py".

Now you should have a file called "test1__sheet1.txt" in the current directory. You could use the "csvchk" program to see the structure of this file:

$ csvchk test1__sheet1.txt
// ****** Record 1 ****** //
name          : Ed
rank          : Captain
serial_number : 12345

If you are processing multiple files, you might find the "--mkdirs" option useful to put all the sheets from each workbook into a separate directories:

$ ./excel2txt.py tests/*.xlsx --outdir out --mkdirs
  1: tests/test1.xlsx
  2: tests/test2.xlsx
Done, see output in "/Users/kyclark/work/python/excel2txt-py/out".

In the "out" directory, there will be "test1" and "test2" directories:

$ find out -type f
out/test1/test1__sheet1.txt
out/test2/test2__sheet1.txt

You can use the "--delimiter" option to change the output file delimiter.

Column, file normalization

The "--normalize" option will alter the headers of each output file to lowercase values and remove non-alphanumeric characters or the underscore. This will also break "CamelCase" values into "snake_case."

This same normalization will be used to create the output file names so as to avoid any possibility of creating output files with illegal or difficult characters.

See also

csvkit, csvchk

Author

Ken Youens-Clark kyclark@gmail.com

Metadata

Release files for excel2txt 0.2.1

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

Source distribution (sdist)

Source distribution for excel2txt 0.2.1
File Size Uploaded Provenance Actions
excel2txt-0.2.1.tar.gz 4.1 kB Without provenance Details for excel2txt-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 9.3 kB

Release files / excel2txt-0.2.1.tar.gz

Download URL excel2txt-0.2.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e6cb8552a5d7010edd2bdf1cc5fe39096f362763ede7ae1d610dec23a13ace79
BLAKE2b-256 checksum
How to use checksums
fd2790034010c806223b53825f6725a88562870d7df00189fe2ae57e950847b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / excel2txt-0.2.1-py3-none-any.whl

Download URL excel2txt-0.2.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9552ec66e564844271965f959830af47a4a1ae768eadcc70dca2e4d16bacb5ba
BLAKE2b-256 checksum
How to use checksums
dba61e1b8efa1ac791d64f494bf955bda5a1aac111fc650816e0dc79e452a1fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Security for excel2txt 0.2.1

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