CLI Tools python Advanced

Rich Table from CSV

Parse any CSV file and render it as a beautiful Rich terminal table.

python
import csv, sys
from rich.console import Console
from rich.table import Table

def csv_to_table(path: str):
    table = Table(show_header=True, header_style="bold green")
    with open(path) as f:
        reader = csv.reader(f)
        headers = next(reader)
        for h in headers:
            table.add_column(h)
        for row in reader:
            table.add_row(*row)
    Console().print(table)

csv_to_table(sys.argv[1])

Prerequisites

  • rich >= 13
  • python >= 3.9

Pro Tips

  • → Pass style="dim" on alternate rows for readability.

Was this module useful?

Share your experience — it helps the team improve.

Leave Feedback

Commercial Licensing

Acquire a production access token or template license for enterprise deployment.

Module Info

Language
python
Level
Advanced
Read time
2 min
Published
Mar 2026
License
Commercial License

Newsletter

New modules every week, directly to your inbox.