tblfmt is a zero-dependency Python CLI tool that reads tabular data from files or stdin and renders it with beautiful Unicode box drawing characters. Pipe-friendly, format-agnostic, and style-rich.
- Zero dependencies -- Uses only Python standard library
- Pipe-friendly --
cat data.csv | tblfmt - Multiple input formats -- CSV, TSV, JSON (array-of-objects), Markdown tables (auto-detected)
- Six border styles -- light, heavy, double, rounded, dashed, ascii
- Flexible alignment -- Global or per-column left/center/right alignment
- Multiple output formats -- terminal, markdown, csv, tsv, json
- CJK-aware -- Correctly calculates display width for East Asian characters
pip install tblfmtOr install from source:
git clone https://github.com/izag8216/tblfmt.git
cd tblfmt
pip install -e .# Render a CSV file with default light Unicode borders
tblfmt data.csv
# Pipe from stdin
cat data.csv | tblfmt --style heavy
# Convert JSON to a formatted table
tblfmt --format json data.json
# Output as Markdown
tblfmt --output markdown data.csv
# Right-align numeric columns
tblfmt --align-col "3:right,4:right" data.csv| Style | Preview |
|---|---|
light (default) |
┌─┬─┐ │ ├─┼─┤ └─┴─┘ |
heavy |
┏━┳━┓ ┃ ┣━╋━┫ ┗━┻━┛ |
double |
╔═╦═╗ ║ ╠═╬═╣ ╚═╩═╝ |
rounded |
╭─┬─╮ │ ├─┼─┤ ╰─┴─╯ |
dashed |
┌╌┬╌┐ ╎ ├╌┼╌┤ └╌┴╌┘ |
ascii |
+-+ | +-+-+ +-+-+ |
# Preview all styles
tblfmt --list-stylestblfmt [file] [options]
Options:
--style {light,heavy,double,rounded,dashed,ascii}
Border style (default: light)
--output {terminal,markdown,csv,tsv,json}
Output format (default: terminal)
--format {auto,csv,tsv,json,markdown}
Input format (default: auto-detect)
--no-header Treat first row as data, not header
--align {left,center,right}
Global cell alignment (default: left)
--align-col COL:ALIGN,...
Per-column alignment, e.g. "1:right,2:center"
--padding N Cell padding spaces (default: 1)
--list-styles Show all styles with preview
--version Show version
-h, --help Show help
# CSV to Markdown
tblfmt --output markdown data.csv
# Markdown to CSV
tblfmt --format markdown --output csv table.md
# JSON to TSV
tblfmt --format json --output tsv data.json# Center all cells
tblfmt --align center data.csv
# Mixed alignment: left col 1, center col 2, right col 3
tblfmt --align-col "1:left,2:center,3:right" data.csv# Add to .bashrc or .zshrc
alias tf='tblfmt'
alias tfm='tblfmt --output markdown'
# Use with other CLI tools
ps aux | head -5 | tblfmt --format tsv --style heavySee CONTRIBUTING.md for development setup and guidelines.
MIT License -- see LICENSE for details.