pub struct Workbook { /* private fields */ }Implementations§
Source§impl Workbook
impl Workbook
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open a workbook, dispatching to the right backend by file extension.
Supported: .xlsx / .xlsm / .xlam (primary, full style resolution via
calamine fast-path + cellXfs walker), .xls / .xla / .xlsb / .ods
(values + defined names via calamine; styles come back empty -
calamine-styles doesn’t parse them for these formats yet), and
.csv / .tsv / .txt (single synthetic sheet, value-only, schema
inference is the source of truth for column types).
pub fn path(&self) -> &Path
pub fn format(&self) -> SourceFormat
pub fn sheet_names(&self) -> &[String]
Sourcepub fn styles(&mut self) -> Result<&mut WorkbookStyles>
pub fn styles(&mut self) -> Result<&mut WorkbookStyles>
Lazy accessor for the pre-parsed styles bundle. First call walks
xl/styles.xml + xl/workbook.xml + rels; subsequent calls reuse
the cached WorkbookStyles.
Only meaningful for .xlsx / .xlsm / .xlam - for other formats returns
an error since there is no OOXML styles part to parse.
Sourcepub fn sheet(&mut self, name: &str) -> Result<Sheet>
pub fn sheet(&mut self, name: &str) -> Result<Sheet>
Load a sheet by name. Reads the entire range eagerly; for huge sheets, callers should pass a row cap downstream rather than load everything.
Sourcepub fn first_sheet(&mut self) -> Result<Sheet>
pub fn first_sheet(&mut self) -> Result<Sheet>
Convenience: first sheet in workbook order.
Sourcepub fn named_ranges(&self) -> Vec<(String, String)>
pub fn named_ranges(&self) -> Vec<(String, String)>
Workbook-level defined names as (name, formula) pairs. Empty for
CSV (no concept of named ranges).
Sourcepub fn table_names_in_sheet(&self, sheet_name: &str) -> Vec<String>
pub fn table_names_in_sheet(&self, sheet_name: &str) -> Vec<String>
Names of workbook tables anchored on the given sheet. Xlsx-only; returns empty on other formats since tables are an xlsx feature.
Sourcepub fn map(&mut self) -> Result<WorkbookMap>
pub fn map(&mut self) -> Result<WorkbookMap>
Build a one-page summary: every sheet’s dimensions, headers, classification, and anchored tables, plus workbook-level defined names. Loads each sheet eagerly to compute density for the classifier — for huge workbooks the caller bears that IO cost.