#csv #slice #extract #data

bin+lib csv-slice

Extract rows or columns from CSV files without loading the entire file

1 unstable release

new 0.1.0 May 18, 2025

#1832 in Parser implementations

MIT license

13KB
138 lines

csv-slice

Extract rows or columns from CSV files without loading the entire file

Installation

Clone the repository and build with Cargo:

cargo build --release

CLI Usage

csv-slice rows --input <csv_file> --start <start> --end <end>
csv-slice columns --input <csv_file> --columns <col1> <col2> ...

Example:

use csv_slice::{extract_rows, extract_columns};

let rows = extract_rows("data.csv", 0, 10)?;
let cols = extract_columns("data.csv", &["Name", "Email"])?;

Examples

Run example programs:

cargo run --example rows -- data.csv 0 10
cargo run --example columns -- data.csv Name Email

Dependencies

~2.2–3MB
~48K SLoC