diff --git a/README.md b/README.md index 2f398ae..83ee91c 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,24 @@ if let Some(Ok(r)) = excel.worksheet_range("Sheet1") { } ``` +### Reader: With options + +```rs +use calamine::{Reader, Xlsx, XlsxOptions, open_workbook}; + +let mut excel: Xlsx<_> = open_workbook("file.xlsx").unwrap(); + +let sheet1 = excel + .with_options(XlsxOptions::default().with_header_row(3)) + .worksheet_range("Sheet1") + .unwrap(); +``` + +Note that for `xlsx` and `xlsb` support lazy loading so the options +are applied directly when reading a sheet. +For `xls` and `ods`, all sheets are loaded when loading the workbook, +which means options are applied after and won't have any benefits in terms of performance. + ### Reader: More complex Let's assume @@ -190,7 +208,7 @@ The programs are all structured to follow the same constructs: use calamine::{open_workbook, Reader, Xlsx}; fn main() { - // Open workbook + // Open workbook let mut excel: Xlsx<_> = open_workbook("NYC_311_SR_2010-2020-sample-1M.xlsx").expect("failed to find file");