slice
Extracts specific rows by range or index list. Supports efficient DuckDB-based slicing for supported formats.
Write with --output. A trailing path is not a positional argument.
# Slice by range
undatum slice data.csv --start 100 --end 200 --output output.csv
# Slice by specific indices
undatum slice data.jsonl --indices 1,5,10,20 --output output.jsonl
--start,--end— 0-based range--indices— comma-separated row indices--output— output path (stdout if omitted)--engine--format-in— override type detection (this command does not take--format-in)
Also accepts --table, --flatten-nested, --on-error, --error-log, and --quotechar (shared options).
Reference
Reads: any readable format · Writes: any writable format; CSV/TSV/JSON/JSON Lines on stdout · Memory: streaming; reading stops after the last selected record · Engines: auto, duckdb, python
undatum slice [OPTIONS] INPUT_FILE
| Argument | Description |
|---|---|
INPUT_FILE | Path to input file. (required) |
| Option | Description | Default |
|---|---|---|
-o, --output TEXT | Optional output file path. If not specified, prints to stdout. | |
--start INTEGER | Start index (inclusive). | |
--end INTEGER | End index (inclusive). | |
--indices TEXT | Comma-separated list of specific indices to extract. | |
-d, --delimiter TEXT | CSV delimiter character (auto-detected when omitted). | |
--quotechar TEXT | CSV quote character (iterabledata default '"' when omitted). | |
--encoding TEXT | File encoding (e.g., 'utf8', 'latin1'). | |
--verbose / --no-verbose | Enable verbose logging output. | --no-verbose |
-F, --format-in TEXT | Override file type detection (e.g., 'csv', 'jsonl'). | |
-e, --engine [auto|duckdb|python] | Processing engine: auto (default), duckdb, or python. | |
--duckdb-threads INTEGER | Number of threads for DuckDB engine. | |
--duckdb-memory TEXT | Memory limit for DuckDB (e.g., '4GB', '512MB'). | |
--duckdb-temp-dir TEXT | Temporary directory for DuckDB. | |
--table, --sheet TEXT | Table or sheet name for multi-table sources (Excel, SQLite, lakehouse). | |
--start-page INTEGER | Sheet index (0-based) for Excel files. | 0 |
--trust | Acknowledge pickle deserialization risk when reading pickle sources. | |
--on-error TEXT | Parse-error policy: raise (default), skip, or warn. | |
--error-log TEXT | Append parse errors as JSONL (use with --on-error skip or warn). | |
--flatten-nested | Unfold nested dict / array-of-dict fields into dotted paths (e.g. city.lat). | |
--max-nested-depth INTEGER | With --flatten-nested, maximum nest depth to unfold (engine default 5). | |
--keep-nested-parents / --no-keep-nested-parents | With --flatten-nested, keep parent dict/array fields alongside dotted children. | --keep-nested-parents |
-O, --format-out TEXT | Output format (e.g. csv, jsonl, parquet). Defaults to the --output extension, or to the input's text format on stdout. |
Deprecated spellings (removed in 2.0): --filetype → --format-in.
See also shared options.