Exporting and Batch Mode
VisiData is not just an interactive TUI — it is also a data conversion engine that can run headlessly in batch mode for scripted pipelines, and accepts piped input from any shell command.
Use Ctrl+S to save from within the TUI. Use -b -o for headless batch conversion. Replay recorded CommandLog sessions for reproducible ETL pipelines.
In-App Saving
Save your current sheet without leaving VisiData:
Ctrl+S save current sheet to file (prompts for path)
g Ctrl+S save all open sheets
z^S save current column only
Ctrl+D save CommandLog to .vdj file
The save format is auto-detected from the file extension (.csv, .json, .tsv, etc.):
# Inside VisiData, after filtering/analysis:
Ctrl+S
# Enter path: /tmp/clean_data.csv
Combine with the filter workflow:
# 1. Filter rows with | regex or z| expr
# 2. Press " to open filtered sheet
# 3. Press Ctrl+S → enter filename
# 4. Enter to save
Stdin Pipe Input
Any command output can be piped into VisiData:
command | vd -f format
# Examples:
ps aux | vd -f fixed --skip 1
df -h | vd -f fixed --skip 1
cat access.log | vd -f txt
curl -s https://example.com/data.csv | vd -f csv
curl -s https://api.github.com/repos/saulpw/visidata/tags | vd -f json
Stdout Pipe Output
VisiData can output a sheet to stdout for further piping:
vd -b input.csv -o - # output to stdout as TSV
vd -b input.csv -o - | grep "error"
Batch Mode: Data Conversion
Batch mode (-b) runs VisiData without the TUI:
# Convert CSV to JSON
vd -b input.csv -o output.json
# Convert JSONL to CSV
vd -b events.jsonl -o events.csv
# Convert Excel to TSV
vd -b report.xlsx -o report.tsv
# Convert SQLite table to CSV
vd -b site.sqlite -o tables_export.csv
# Convert fixed-width to JSON
ps aux | vd -f fixed --skip 1 -b -o processes.json
CommandLog Replay
VisiData records every action in a CommandLog (.vdj file). Save and replay sessions for reproducible batch processing.
# Inside VisiData:
Shift+D # view CommandLog sheet
Ctrl+S # save it as a .vdj file
Basic Replay
vd --play session.vdj
Parameterised Replay with field=value
Use {field} placeholders in your CommandLog to make it reusable:
# A CommandLog session.vdj contains:
# open-file filename={input_file}
# save-sheet filename={output_file}
# Replay with specific files:
vd --play session.vdj input_file=jan.csv output_file=/tmp/jan_clean.csv
vd --play session.vdj input_file=feb.csv output_file=/tmp/feb_clean.csv
This turns a recorded session into a reusable ETL script:
#!/bin/bash
for month in jan feb mar; do
vd --play clean_pipeline.vdj \
input_file=data_${month}.csv \
output_file=/tmp/reports/${month}_clean.csv
done
-i — Interactive Mode After Replay
# Replay session, then open VisiData interactively
vd --play session.vdj -i
Useful for debugging: run replay → pause at last state → inspect manually.
Practical Pipelines
Nginx Log Analysis
# Extract and export
vd -b access.log -o /tmp/access_analysis.csv
Multi-File Batch Conversion
for f in ~/github/practice-folder/visidata/04-cleaning/*.csv; do
base=$(basename "$f" .csv)
vd -b "$f" -o "/tmp/json/${base}.json"
done
Daily Report Automation
DATE=$(date +%Y%m%d)
vd -b ~/github/practice-folder/visidata/05-logs/01-access.log \
-o /var/www/html/reports/access_${DATE}.csv
Batch Mode Options
| Option | Description |
|---|---|
-b / --batch | Run without TUI |
-o file / --output file | Save final sheet to file |
--play file.vdj | Replay a saved CommandLog |
--replay-wait N | Wait N seconds between replayed commands |
-i / --interactive | Launch interactively after batch replay |
field=value | Replace {field} placeholders in CommandLog |
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Batch outputs empty file | Pipe closes before read | Use explicit file instead of stdin |
| CommandLog replay fails | Sheet structure changed | Re-record the session |
| Format not detected in batch | No extension or stdin | Always use -f format in scripts |
| Encoding error in batch | Non-UTF-8 input | Add --encoding latin1 |
Best Practices
- Always specify
-fin batch scripts — never rely on auto-detection in automation. - Use CommandLog replay (
--play) to document and share data transformation steps. - Pipe
vd -b input -o -into other tools (grep,jq,awk) for lightweight ETL. - Set
--max-rowswhen sampling large files in batch to avoid long runtimes.
What's Next
- Performance and Profiling — large files, sampling, lazy loading
- Opening Files and Formats — load CSV, JSON, SQLite, Excel, and more