Skip to main content

wolfxl_core/
lib.rs

1//! wolfxl-core: pure-Rust spreadsheet reader with Excel number-format-aware rendering.
2//!
3//! This crate carries no PyO3 / Python coupling. It opens spreadsheets via
4//! [`calamine-styles`] for xlsx / xls / xlsb / ods and a built-in reader
5//! for CSV, exposes a `Workbook → Sheet → Cell` API, and renders cell
6//! values with awareness of common Excel number formats (currency,
7//! percentage, scientific, date, time).
8//!
9//! ```no_run
10//! use wolfxl_core::Workbook;
11//!
12//! let mut wb = Workbook::open("examples/sample-financials.xlsx")?;
13//! let sheet = wb.first_sheet()?;
14//! let (rows, cols) = sheet.dimensions();
15//! println!("{} rows × {} columns", rows, cols);
16//! # Ok::<_, wolfxl_core::Error>(())
17//! ```
18//!
19//! ## Scope
20//!
21//! - **In scope today:** read xlsx / xls / xlsb / ods / csv values + best-effort
22//!   number-format strings (xlsx only — calamine leaves xls/xlsb/ods style ranges
23//!   empty and CSV has no style concept), classify formats into
24//!   [`FormatCategory`], render via [`format_cell`], map workbook structure,
25//!   infer per-column schema/cardinality summaries (reads through
26//!   numeric-looking strings so CSV columns classify correctly), and walk
27//!   `xl/styles.xml` cellXfs + numFmts as a fallback when calamine's fast
28//!   path returns None (covers openpyxl-generated fixtures).
29//! - **Not yet:** write side.
30//!
31//! The existing PyO3 layer in the sibling `wolfxl` cdylib still owns its own
32//! implementation; unifying the two is follow-up work.
33
34pub mod cell;
35mod csv_reader;
36pub mod error;
37pub mod format;
38pub mod map;
39pub mod ooxml;
40pub mod schema;
41pub mod sheet;
42pub mod styles;
43pub mod workbook;
44pub mod worksheet_xml;
45
46pub use cell::{Cell, CellValue};
47pub use error::{Error, Result};
48pub use format::{classify_format, format_cell, FormatCategory};
49pub use map::{classify_sheet, SheetClass, SheetMap, WorkbookMap};
50pub use schema::{infer_sheet_schema, Cardinality, ColumnSchema, InferredType, SheetSchema};
51pub use sheet::Sheet;
52pub use styles::{builtin_num_fmt, resolve_num_fmt, XfEntry, BUILTIN_NUM_FMTS};
53pub use workbook::{SourceFormat, Workbook, WorkbookStyles};