A lightweight and user-friendly CSV viewer built with Python, designed for quick inspection and basic manipulation of CSV, TSV, or other delimited text files.
- Overview
- Features
- Requirements
- Installation
- Usage
- Code Structure
- Enhancement Ideas
- Contributing
- License
This tool lets users easily view tabular data from CSV or delimited files via a CLI. It provides quick insights into large datasets without the need for spreadsheets or data-heavy tools by leveraging Pythonβs standard library :contentReference[oaicite:1]{index=1}.
- π Read local delimited files (CSV, TSV, custom separators)
- π’ Display row count, headers, and sample rows
- π Sort data by column alphabetically or numerically
- β Clean handling of missing or malformed lines
- π οΈ Option to export a cleaned/filtered view to a new file
- Python 3.7+
- Only uses the Python standard library (
csv
,argparse
,sys
, etc.)
git clone https://github.com/MisaghMomeniB/CSV-Viewer-Python.git cd CSV-Viewer-Python python3 --version # Confirm Python β₯3.7
Basic usage:
python csv_viewer.py --path data.csv --delimiter comma --sample 20
Available flags:
--path <file>
: Path to your CSV/TSV file--delimiter <char>
:comma
,semicolon
,tab
, or custom--sample <int>
: Number of rows to preview (default: 10)--sort <column>
: Sort preview by this column--export <file>
: Save cleaned/sample rows to a new file
CSV-Viewer-Python/
βββ csv_viewer.py # Main CLI + core logic
βββ README.md # You're reading it!
βββ LICENSE
Inside csv_viewer.py
:
- Argparse handles CLI options
- Uses
csv.reader
/csv.DictReader
for parsing - Basic validation of headers, row counts, and empty fields
- Functions to preview and optionally export data
- π Add interactive filter options (e.g., show rows where column > value)
- π¦ Support export to formats like JSON or Markdown tables
- π Integrate with Pandas for advanced previews or plotting
- π§ Build a GUI with libraries like Tkinter or PyQt
- π Add batch previewing for multi-file browsing
Improvements welcome! Possible additions:
- Support large files via streaming
- Implement real-time file watching
- Add deduplication or column-based filters
To contribute:
- Fork this repo
- Create a branch (
feature/...
) - Write clear, well-commented code
- Open a Pull Request with a description of changes
Licensed under the MIT License β see LICENSE
file for details.