Quickstart¶
csvsmith provides small tools that can be used independently or combined in a CSV workflow. Start with the task closest to your data; command-specific options live on the linked tool pages.
Convert a worksheet¶
Convert the first worksheet in an Excel workbook:
csvsmith excel-to-csv input.xlsx -o output.csv
Use --sheet-name when the workbook contains multiple worksheets. See
Excel to CSV.
Inspect and compare data¶
Find exact normalized matches anywhere in a CSV:
csvsmith find-matches data.csv "Alice" --ignore-case
Compare two individual strings:
csvsmith string-distance "Apple Inc." "apple inc" --ignore-case
See Find Matches and String Distance.
Filter and deduplicate rows¶
Remove rows whose status column contains deprecated:
csvsmith drop-rows data.csv status "deprecated" --case-insensitive
Remove duplicate rows using selected columns:
csvsmith dedupe data.csv -o clean.csv --subset id,name --report duplicates.json
To inspect duplicates without writing a deduplicated file:
csvsmith row-duplicates data.csv --subset id,name
See Drop Rows and Deduplication.
Combine compatible CSV files¶
Concatenate every CSV in a directory when their headers match exactly:
csvsmith strict-concat incoming/ -o combined.csv
The output includes a file_stem column identifying each source file. See
Strict Concat.
Organize file collections¶
Preview automatic CSV classification by header:
csvsmith classify incoming/ organized/ --auto --dry-run
Move files by suffix:
csvsmith move-files organized/ processed/ --suffixes csv,pdf
classify supports --dry-run; move-files always performs the move.
See Classify and Move Files.
Concentrate repeated long values¶
Replace repeated values in selected columns with deterministic tokens, then restore them later using the generated map:
csvsmith concentrate input.csv --columns description,notes
csvsmith rehydrate input.dense.csv -m input.dense-map.json -o restored.csv
This workflow is intended for long, repeated values; it can enlarge data made mostly of short strings. See Concentrate and rehydrate CSV values for scope and storage trade-offs.
Clean individual numeric values¶
Normalize a numeric or currency string:
csvsmith clean-numeric "3,000.50"
csvsmith clean-currency-numeric '$3,000.50'
These commands process one value at a time. For CSV-wide transformations, use the Python API in a script. See Clean Numeric and Currency.
Next steps¶
Browse CLI Reference for the complete command list.
Use Python API when integrating csvsmith into Python code.
See Recipes for a few multi-step workflows.