Skip to main content

Converts to Excel XLSX from a TSV or CSV text file.

Project description

text2excel

This program converts CSV Or TSV text files to Microsoft Excel format. It uses openpyxl to create Excel files.

As input it takes tab-separated *.txt files (TSV), or any CSV files (Comma-Separated Values) that can be auto-detected by the Python standard library csv module.

Example

$ printf "one\ttwo\tthree\n1\t2\t3\n" | tee my_data_file.txt
one two three
1   2   3

$ text2excel --numbers my_data_file.txt
Saved to file: my_data_file.xlsx

Installation

I recommend installing text2excel with pipx:

pipx install text2excel

If you don't already have it, a guide for how to install pipx is provided below on this page.

To upgrade text2excel to the latest version, simply run:

pipx upgrade text2excel

Or pipx upgrade-all if you want to go crazy. 😉

If you want to bundle up text2excel into a single, standalone executable Python zipapp, I highly recommend shiv. For example:

shiv -o text2excel -p "/usr/bin/env python3" -c text2excel text2excel

If shiv doesn't work for you for some reason, you can also use PEX:

pex -o text2excel -c text2excel text2excel

Installing pipx

I suggest installing everything with pipx, because it is fantastic. 🙂

python3 -m pip install --user pipx
python3 -m pipx ensurepath

At this point, you may need to logout to refresh your shell $PATH before proceeding.

For further details, see the official pipx installation guide.

Installing shiv

I recommend that you use pipx to install shiv:

pipx install shiv

Alternatively, if you really don't want to use pipx for some reason, you can simply run python3 -m pip install --user shiv. Then, if necessary, manually reconfigure your shell $PATH to find any pip installed binaries.

News

Please see the changelog for more details.

Contributing

Do you want to help out with this project?

Credits

This project was originally based on a Gist by Konrad Förstner.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text2excel-0.4.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

text2excel-0.4.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page