pub fn extract_rows<P: AsRef<Path>>(
path: P,
start: usize,
end: usize,
) -> Result<Vec<StringRecord>, CsvSliceError>Expand description
Extracts a range of rows from a CSV file.
§Parameters
path- Path to the CSV file. Can be any type that can be converted to a Path.start- The index of the first row to extract (0-based, excluding header).end- The index after the last row to extract (exclusive).
§Returns
Result<Vec<StringRecord>, CsvSliceError>- A vector of StringRecords on success, or a CsvSliceError on failure.
§Example
use csv_slice::extract_rows;
let rows = extract_rows("data.csv", 0, 5).unwrap();
// This extracts the first 5 rows from data.csv