Best CSV Tools for the Command Line
Compare Miller, VisiData, xsv, qo and csvlens for querying, transforming and browsing CSV files from the terminal.
Updated
short verdict
Start with Miller for scripted CSV work: it is field-name based, streams records, and reads CSV, TSV, JSON and JSON Lines. Pick VisiData to explore interactively, qo if you want to write SQL, and csvlens for read-only viewing. xsv is fast on large files but the original project is unmaintained.
Working with CSV in a terminal covers four jobs: transforming files in pipelines, querying them, browsing them, and editing or diffing them. The tools here split along those lines. Miller and xsv are command-line processors, qo runs SQL through SQLite, VisiData and csvlens are interactive viewers, and daff and csvi handle diffs and edits.
this page is for
- Developers who script CSV cleanup and conversion in shell pipelines
- Analysts who want to explore a file interactively before writing a query
- People who think in SQL and want to query CSV or JSON without a database
- Teams that keep CSV files in git and need readable diffs
The best default for CSV processing in pipelines: awk/sed/cut/join/sort-style verbs that work on named fields.
best for
- Scripted cleanup and transforms
- Converting between CSV, TSV, JSON and JSON Lines
- Files larger than RAM
strengths
- Addresses columns by field name instead of position, across CSV, TSV, JSON and JSON Lines
- Streams records, keeping one in memory for most operations, so large files work
- Adds computed fields, drops columns, sorts and aggregates, and keeps CSV headers when sorting
- Installs with brew, apt-get or go install
weaknesses
- No interactive interface for browsing data
- Its verb and expression syntax is its own language, not SQL
The most capable interactive tool: a spreadsheet-style terminal view with hundreds of keyboard commands over CSV, JSON, SQLite and Excel.
best for
- Exploring unfamiliar datasets
- Mixed formats such as xlsx, SQLite and HDF5
- Piping command output into a browsable table
strengths
- Opens CSV, TSV, JSON, SQLite, xlsx, HDF5 and more from files or stdin
- Browse, filter, sort and manipulate data without leaving the terminal
- Ctrl+H shows a quick reference for its many commands
weaknesses
- Requires Python 3.8+; Windows support is through WSL
- xlsx and XML formats need extra packages (openpyxl, lxml)
- Hundreds of commands mean a longer learning curve than a viewer
A fast Rust CSV toolkit with 20+ chainable commands, but the original project is no longer maintained.
best for
- Quick stats and frequency tables on large files
- Fast slicing of big files using an index
- Joins and sampling from the shell
strengths
- Commands include count, stats, search, select, sort, join and frequency
- An index gives constant-time slicing, such as the last 10 rows of a multi-million-row file
- stats reports data types, ranges, means, standard deviations and cardinality
- Supports inner, outer and cross joins using hash indexes
weaknesses
- The original project is unmaintained and its author points to maintained successors
- CSV only; no JSON or JSON Lines handling
- Output is plain text, with table for alignment and no interactive view
Runs SQL against CSV and JSON files through SQLite, in an interactive TUI or as a one-shot command.
best for
- Ad hoc SQL over CSV, TSV, PSV or JSON
- Joins across multiple files
- Converting formats with a query in between
strengths
- Full SQLite syntax, including JSON extraction functions for nested data
- Non-interactive mode takes a query with the -q flag and writes to stdout
- Reads CSV, TSV, PSV, JSON and JSONL from stdin or file arguments
- TUI has vim-style navigation and tabs for query editing and results
weaknesses
- Smaller project than Miller or VisiData
- Focused on querying, with no editing or diffing
- Installs via a Homebrew tap or a shell script, not common package managers
A focused CSV viewer with hjkl navigation, regex filtering and sorting, for reading a file rather than transforming it.
best for
- Quickly looking at a CSV or piped output
- Filtering rows or columns with a regex
- Copying cells or printing filtered rows to stdout
strengths
- Filter with & and * regex commands; sort by column with natural ordering
- Reads files or stdin, with auto-detected delimiters plus tab and custom separators
- Freezes columns, adjusts widths and supports wrapping
- Available via brew, cargo and pacman
weaknesses
- Viewer only; it does not edit files
- No SQL or aggregation, so filtering is regex-based
- CSV-focused, without the multi-format support of VisiData
The tool for comparing two versions of a table and for readable CSV diffs and merges in git.
best for
- CSV files tracked in git
- Generating patches between table versions
- HTML diff reports
strengths
- daff git csv gives structure-aware diffs and merges instead of line-by-line ones
- Diff, patch, merge and render commands; primary keys and ignored columns are configurable
- Handles CSV, TSV, SQLite and ndjson, with HTML output that highlights changes
- Installs through npm, pip, gem or composer
weaknesses
- Only compares tables; it does not query or transform them
- Works on tables that share a common origin
A vi-style terminal CSV editor that changes only the cells you edit, so diffs stay small.
best for
- Hand-editing production CSV files
- Files with unusual encodings or separators
- Edits that must leave the original formatting alone
strengths
- Preserves quotes, line endings, encoding and separators; only edited cells change
- vi keys: h/j/k/l to move, dd and dc to delete, y and p to copy and paste, u to undo a cell
- Handles UTF-8, UTF-16 and Windows code pages with auto-detection
- Loads large files in the background and reads stdin
weaknesses
- An editor, with no query, aggregation or join features
- Install options are Scoop and go install, with no brew or apt route listed
How to choose
Match the tool to the job you do most often.
- Scripted transforms: Miller wins, with named-field verbs and streaming that keeps memory use low.
- SQL queries: qo wins, since it runs SQLite syntax, including joins across files, from the -q flag.
- Interactive exploration: VisiData wins, with spreadsheet-style browsing over CSV, JSON, SQLite and Excel.
- Quick read-only viewing: csvlens wins, with hjkl navigation, regex filters and stdin support.
- Diffs in git: daff wins, through daff git csv and keyed row matching.
When not to use these
- You need heavy joins and window functions across many large tables; load the data into a real database instead.
- Your data is in Excel workbooks with formulas and formatting that must survive; a spreadsheet application fits better.
FAQ
- What is the best CSV tool for the command line?
- Miller is the best default for pipelines: it works on named fields and streams records. For interactive exploration use VisiData, and for SQL use qo.
- Can I query a CSV file with SQL from the terminal?
- Yes, with qo. It uses SQLite as its engine and accepts a query through the -q flag or in its TUI. It reads CSV, TSV, PSV, JSON and JSONL, and supports joins across files.
- Is xsv still maintained?
- The original xsv project is unmaintained, and its author recommends maintained successors. It still offers fast stats, indexing and joins on CSV, but consider a maintained tool for new work.
- How do I get readable diffs for CSV files in git?
- Use daff. Its daff git csv command integrates with git to diff and merge by table structure instead of by line. It can also output HTML diffs and patch files.