# mathnya/umya-spreadsheet architecture

> Architecture diagram of the GitHub repository mathnya/umya-spreadsheet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mathnya/umya-spreadsheet
- Repository: https://github.com/mathnya/umya-spreadsheet

## Overview

umya-spreadsheet is a pure-Rust library for reading, editing, and writing Excel workbooks. The principal flow is an application reading an XLSX/XLSM file into a workbook, manipulating worksheets and spreadsheet content through its public model, then writing an XLSX/XLSM or CSV result. The README also documents lazy and streaming reads, password-protected writing, and support for charts, drawings, images, and OLE objects. Some specialized reader and writer components are unsampled; their links are shown only where the README or source index supports them.

Main entry points: [`src/reader/xlsx.rs`](https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/xlsx.rs) (XLSX Reader), [`src/structs/worksheet.rs`](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/worksheet.rs) (Worksheet Model), [`src/writer/xlsx.rs`](https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/xlsx.rs) (XLSX Writer), [`src/structs/workbook.rs`](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/workbook.rs) (Workbook Model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_io["File I/O"]
  node_xlsx_reader["XLSX Reader<br/>[xlsx.rs]"]
  node_read_driver["Read Driver<br/>[driver.rs]"]
  node_sheet_parser["Worksheet Parser<br/>[worksheet.rs]"]
  node_raw_sheet["Raw Worksheet<br/>[raw_worksheet.rs]"]
  node_xlsx_writer["XLSX Writer<br/>[xlsx.rs]"]
  node_write_driver["Write Driver<br/>[driver.rs]"]
  node_csv_writer["CSV Writer<br/>[csv.rs]"]
end

subgraph group_model["Workbook Model"]
  node_workbook["Workbook Model<br/>[workbook.rs]"]
  node_worksheet["Worksheet Model<br/>[worksheet.rs]"]
  node_cell_data["Cells and Rows<br/>[cells.rs]"]
end

subgraph group_features["Spreadsheet Features"]
  node_styles["Cell Styles<br/>[style.rs]"]
  node_charts_drawings["Charts and Drawings<br/>[drawing.rs]"]
  node_media_objects["Images and Objects<br/>[image.rs]"]
end

subgraph group_helpers["Shared Helpers"]
  node_formula_tools["Formula Tools<br/>[formula.rs]"]
  node_format_tools["Value Formatting<br/>[number_format.rs]"]
  node_crypto["Protection Crypto<br/>[mod.rs]"]
end

node_application(("Application"))

node_application -->|"reads workbook"| node_xlsx_reader
node_application -->|"creates workbook"| node_workbook
node_xlsx_reader -->|"uses helpers"| node_read_driver
node_xlsx_reader -->|"loads metadata"| node_workbook
node_xlsx_reader -->|"stores raw data"| node_raw_sheet
node_xlsx_reader -->|"parses sheets"| node_sheet_parser
node_application -->|"streams sheet cells"| node_sheet_parser
node_workbook -.->|"provides sheets"| node_worksheet
node_worksheet -.->|"contains cell data"| node_cell_data
node_application -->|"edits worksheets"| node_worksheet
node_application -->|"edits styles"| node_styles
node_application -->|"edits charts"| node_charts_drawings
node_application -->|"edits objects"| node_media_objects
node_application -->|"writes workbook"| node_xlsx_writer
node_xlsx_writer -->|"uses helpers"| node_write_driver
node_xlsx_writer -->|"serializes sheets"| node_worksheet
node_xlsx_writer -->|"writes embeddings"| node_media_objects
node_application -->|"writes CSV"| node_csv_writer
node_application -->|"sets password"| node_crypto
node_worksheet -.->|"adjusts formulas"| node_formula_tools
node_cell_data -.->|"formats values"| node_format_tools

click node_xlsx_reader "https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/xlsx.rs"
click node_read_driver "https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/driver.rs"
click node_sheet_parser "https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/xlsx/worksheet.rs"
click node_raw_sheet "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/raw/raw_worksheet.rs"
click node_xlsx_writer "https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/xlsx.rs"
click node_write_driver "https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/driver.rs"
click node_csv_writer "https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/csv.rs"
click node_workbook "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/workbook.rs"
click node_worksheet "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/worksheet.rs"
click node_cell_data "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/cells.rs"
click node_styles "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/style.rs"
click node_charts_drawings "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/drawing.rs"
click node_media_objects "https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/image.rs"
click node_formula_tools "https://github.com/mathnya/umya-spreadsheet/blob/master/src/helper/formula.rs"
click node_format_tools "https://github.com/mathnya/umya-spreadsheet/blob/master/src/helper/number_format.rs"
click node_crypto "https://github.com/mathnya/umya-spreadsheet/blob/master/src/helper/crypt/mod.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_xlsx_reader,node_read_driver,node_sheet_parser,node_raw_sheet,node_xlsx_writer,node_write_driver,node_csv_writer toneBlue
class node_workbook,node_worksheet,node_cell_data toneAmber
class node_styles,node_charts_drawings,node_media_objects toneMint
class node_formula_tools,node_format_tools,node_crypto toneRose
class node_application toneIndigo
```

## Components

### File I/O

- [XLSX Reader](https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/xlsx.rs): `src/reader/xlsx.rs`
- [Read Driver](https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/driver.rs): `src/reader/driver.rs`
- [Worksheet Parser](https://github.com/mathnya/umya-spreadsheet/blob/master/src/reader/xlsx/worksheet.rs): `src/reader/xlsx/worksheet.rs`
- [Raw Worksheet](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/raw/raw_worksheet.rs): `src/structs/raw/raw_worksheet.rs`
- [XLSX Writer](https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/xlsx.rs): `src/writer/xlsx.rs`
- [Write Driver](https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/driver.rs): `src/writer/driver.rs`
- [CSV Writer](https://github.com/mathnya/umya-spreadsheet/blob/master/src/writer/csv.rs): `src/writer/csv.rs`

### Workbook Model

- [Workbook Model](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/workbook.rs): `src/structs/workbook.rs`
- [Worksheet Model](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/worksheet.rs): `src/structs/worksheet.rs`
- [Cells and Rows](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/cells.rs): `src/structs/cells.rs`

### Spreadsheet Features

- [Cell Styles](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/style.rs): `src/structs/style.rs`
- [Charts and Drawings](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/drawing.rs): `src/structs/drawing.rs`
- [Images and Objects](https://github.com/mathnya/umya-spreadsheet/blob/master/src/structs/image.rs): `src/structs/image.rs`

### Shared Helpers

- [Formula Tools](https://github.com/mathnya/umya-spreadsheet/blob/master/src/helper/formula.rs): `src/helper/formula.rs`
- [Value Formatting](https://github.com/mathnya/umya-spreadsheet/blob/master/src/helper/number_format.rs): `src/helper/number_format.rs`
- [Protection Crypto](https://github.com/mathnya/umya-spreadsheet/blob/master/src/helper/crypt/mod.rs): `src/helper/crypt/mod.rs`

### Other components

- **Application**

## Connections

- Application → XLSX Reader: reads workbook
- Application → Workbook Model: creates workbook
- XLSX Reader → Read Driver: uses helpers (evidence: `src/reader/xlsx.rs`)
- XLSX Reader → Workbook Model: loads metadata (evidence: `src/reader/xlsx.rs`)
- XLSX Reader → Raw Worksheet: stores raw data (evidence: `src/reader/xlsx.rs`)
- XLSX Reader → Worksheet Parser: parses sheets (evidence: `src/reader/xlsx.rs`)
- Application → Worksheet Parser: streams sheet cells
- Workbook Model → Worksheet Model: provides sheets
- Worksheet Model → Cells and Rows: contains cell data
- Application → Worksheet Model: edits worksheets
- Application → Cell Styles: edits styles
- Application → Charts and Drawings: edits charts
- Application → Images and Objects: edits objects
- Application → XLSX Writer: writes workbook
- XLSX Writer → Write Driver: uses helpers (evidence: `src/writer/xlsx.rs`)
- XLSX Writer → Worksheet Model: serializes sheets (evidence: `src/writer/xlsx.rs`)
- XLSX Writer → Images and Objects: writes embeddings
- Application → CSV Writer: writes CSV
- Application → Protection Crypto: sets password
- Worksheet Model → Formula Tools: adjusts formulas
- Cells and Rows → Value Formatting: formats values
