CLI tool that turns a CSV file into an HTML table with basic formatting
Project description
tablify-csv
CLI tool to convert data in a CSV file into an HTML table with basic formatting.
The tool lets you:
- Specify column headings to be displayed on the final HTML table
- Assign class names to any column (assign to
td
tags that fall under a given column) - Save the output (prettified) HTML into a file
Requirements
- Python >= 3.8
- lxml >= 4.5.2
- prompt-toolkit >= 3.0.6
- typer >= 0.3.2
Please see requirements.txt
and dev-requirements.txt
for full list of dependencies.
Installation
It's recommended to create and activate a virtual environment before installing.
To install the latest development version, run the following:
$ pip install git+https://github.com/ralphqq/tablify-csv
Usage
If applicable, make sure that the virtual environment where you pip installed tablify-csv
is activated.
To convert a CSV file, run:
$ tablify-csv CSV_FILENAME
This will save the HTML table in a file with the same name as the CSV file except the extension will be .html
.
To specify a filename for the output file, run:
$ tablify-csv CSV_FILENAME --output-file OUTPUT_FILENAME
Development Setup
- Clone this repo at https://github.com/ralphqq/tablify-csv
- Create and activate a virtual environment
- Install the development dependencies:
$ pip install -r dev-requirements.txt
- Run the test suite:
$ pytest
Note: To ensure coding style consistency, this project uses pre-commit hooks. You may also want to initialize pre-commits into your local development clone (this is strongly recommended if you want to contribute, see Contributing
section).
$ pre-commit install
Contributing
- Fork this repo at https://github.com/ralphqq/tablify-csv
- Clone your fork into your local machine
- Follow steps in Development Setup but skip step 1
- Initialize pre-commit hooks
$ pre-commit install
- Create your feature branch:
$ git checkout -b feature/some-new-thing
- Commit your changes:
$ git commit -m "Develop new thing"
- Push to the branch:
$ git push origin feature/some-new-thing
- Create a pull request
License
tablify-csv
is available under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.