Skip to main content

Crate wolfxl_core

Crate wolfxl_core 

Source
Expand description

wolfxl-core: pure-Rust spreadsheet reader with Excel number-format-aware rendering.

This crate carries no PyO3 / Python coupling. It opens spreadsheets via [calamine-styles] for xlsx / xls / xlsb / ods and a built-in reader for CSV, exposes a Workbook → Sheet → Cell API, and renders cell values with awareness of common Excel number formats (currency, percentage, scientific, date, time).

use wolfxl_core::Workbook;

let mut wb = Workbook::open("examples/sample-financials.xlsx")?;
let sheet = wb.first_sheet()?;
let (rows, cols) = sheet.dimensions();
println!("{} rows × {} columns", rows, cols);

§Scope

  • In scope today: read xlsx / xls / xlsb / ods / csv values + best-effort number-format strings (xlsx only — calamine leaves xls/xlsb/ods style ranges empty and CSV has no style concept), classify formats into FormatCategory, render via format_cell, map workbook structure, infer per-column schema/cardinality summaries (reads through numeric-looking strings so CSV columns classify correctly), and walk xl/styles.xml cellXfs + numFmts as a fallback when calamine’s fast path returns None (covers openpyxl-generated fixtures).
  • Not yet: write side.

The existing PyO3 layer in the sibling wolfxl cdylib still owns its own implementation; unifying the two is follow-up work.

Re-exports§

pub use cell::Cell;
pub use cell::CellValue;
pub use error::Error;
pub use error::Result;
pub use format::classify_format;
pub use format::format_cell;
pub use format::FormatCategory;
pub use map::classify_sheet;
pub use map::SheetClass;
pub use map::SheetMap;
pub use map::WorkbookMap;
pub use schema::infer_sheet_schema;
pub use schema::Cardinality;
pub use schema::ColumnSchema;
pub use schema::InferredType;
pub use schema::SheetSchema;
pub use sheet::Sheet;
pub use styles::builtin_num_fmt;
pub use styles::resolve_num_fmt;
pub use styles::XfEntry;
pub use styles::BUILTIN_NUM_FMTS;
pub use workbook::SourceFormat;
pub use workbook::Workbook;
pub use workbook::WorkbookStyles;

Modules§

cell
error
format
Number-format detection and cell-value rendering.
map
Workbook map: one-page summary of every sheet (dimensions, headers, classification, anchored tables) plus workbook-level named ranges.
ooxml
OOXML zip/XML helpers. Pure-Rust, no PyO3 coupling.
schema
Per-column schema inference: type, null count, cardinality, format.
sheet
styles
Pure-Rust xl/styles.xml reader — cellXfs + numFmts.
workbook
worksheet_xml
Worksheet XML walker — builds a per-cell (row, col) → styleId map.