A command line tool to convert tables in various formats.
- CSV to Markdown
- CSV to JSON
- CSV to HTML
- Markdown to CSV
- Markdown to JSON
pip install --upgrade tableconverter
You can give the input file and the destination format, e.g.
tableconverter demos/assets/example.csv -d html
and the output will be
<table>
<tr>
<th>col1</th>
<th>col2</th>
<th>col3</th>
</tr>
<tr>
<td>aaaa</td>
<td>bbbb</td>
<td>cccc</td>
</tr>
<tr>
<td>!@#$</td>
<td>%^&*</td>
<td>()<></td>
</tr>
<tr>
<td>1111</td>
<td>2222</td>
<td>3333</td>
</tr>
</table>
You can also give the output file, e.g.
tableconverter demos/assets/example.csv -d html -o example.html
and the output will be written to example.html
.
If no input file is given, the command will expect the input from stdin
. In this case, the source format -s csv
MUST be given.
tableconverter -s csv -d html -o example.html
# input CSV here
# ends with <CTRL-D> on Unix or <CTRL-Z> on Windows
You can also so use the command with Heredoc
and the output will be the same.
cat << EOF | tableconverter -s csv -d html > example.html
> col1,col2,col3
> aaaa,bbbb,cccc
> !@#$,%^&*,()<>
> 1111,2222,3333
> EOF
- CSV
- Markdown
- HTML
- JSON
PyTableConverter is released under the terms of the MIT license.