# spreadsheet-kit
[](https://crates.io/crates/spreadsheet-kit)
[](https://github.com/PSU3D0/spreadsheet-mcp/blob/main/LICENSE)
Core shared primitives for the [spreadsheet-kit](https://github.com/PSU3D0/spreadsheet-mcp) workspace.
## What's in this crate
- **`CellEdit`** — canonical cell edit type (address + value + is_formula)
- **`CoreWarning`** — structured warning type (code + message)
- **`BasicDiffChange` / `BasicDiffResponse`** — diff result types
- **`RecalculateOutcome`** — recalc result metadata (backend, duration, cells evaluated, errors)
- **Edit normalization** — `normalize_shorthand_edit()` parses `"A1=100"` / `"B2==SUM(...)"` into `CellEdit`
- **`apply_edits_to_file()`** — applies a batch of `CellEdit`s to an `.xlsx` file via `umya-spreadsheet`
- **`SessionRuntime` trait** — scaffold for stateful session backends (open / apply_edits / recalculate / save_as)
## What's intentionally not here
- **MCP server logic** — see [`spreadsheet-mcp`](../spreadsheet-mcp/)
- **CLI surface** — see [`agent-spreadsheet`](../agent-spreadsheet/)
- **Region detection, caching, formula analysis** — all in `spreadsheet-mcp`
- **Recalc backends** — Formualizer and LibreOffice integration lives in `spreadsheet-mcp` behind feature flags
This crate is kept minimal so both the MCP server and the CLI can depend on it without pulling in server-specific dependencies.
## Usage
```toml
[dependencies]
spreadsheet-kit = "0.1"
```
```rust
use spreadsheet_kit::write::normalize_shorthand_edit;
let edit = normalize_shorthand_edit("A1=42").unwrap();
assert_eq!(edit.address, "A1");
assert_eq!(edit.value, "42");
assert!(!edit.is_formula);
let formula = normalize_shorthand_edit("B2==SUM(A1:A2)").unwrap();
assert_eq!(formula.address, "B2");
assert_eq!(formula.value, "SUM(A1:A2)");
assert!(formula.is_formula);
```
## Consumers
| [`spreadsheet-mcp`](../spreadsheet-mcp/) | Stateful MCP server |
| [`agent-spreadsheet`](../agent-spreadsheet/) | Stateless CLI |
## License
Apache-2.0 — see [LICENSE](../../LICENSE).