Skip to main content

Workbook

Struct Workbook 

Source
pub struct Workbook { /* private fields */ }

Implementations§

Source§

impl Workbook

Source

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).

Source

pub fn path(&self) -> &Path

Source

pub fn format(&self) -> SourceFormat

Source

pub fn sheet_names(&self) -> &[String]

Source

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.

Source

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.

Source

pub fn first_sheet(&mut self) -> Result<Sheet>

Convenience: first sheet in workbook order.

Source

pub fn named_ranges(&self) -> Vec<(String, String)>

Workbook-level defined names as (name, formula) pairs. Empty for CSV (no concept of named ranges).

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.