Links
AI / Agents
Developers
Community
Full license MIT
Meta
Requires: Python >=3.11
Provides-Extra: fast, networkx, viz, all, skills
excel-grapher
Build and analyze dependency graphs from Excel workbooks, evaluate formulas with Excel semantics, and export standalone Python code.
A SovTech tool, built by Teal Insights and commissioned by NatureFinance.
Documentation: https://teal-insights.github.io/excel-grapher/
Why this exists
- Transpilation support: trace formula dependencies to enable Excel → Python translation.
- Interpretability: visualize and sanity-check spreadsheet logic (GraphViz, Mermaid, NetworkX).
- Performance-minded: focuses on targeted dependency closure from specific output cells/ranges.
- Excel semantics in Python: run workbook logic in-process with a full Excel-like evaluator.
- Exportable: emit standalone Python packages that embed only the runtime surface you need.
Library layout
The unified distribution is excel-grapher and exposes a single import package, excel_grapher, with five main subpackages:
excel_grapher/core/— shared semantic types, coercions, and scalar operators.excel_grapher/runtime/— Excel-equivalent function implementations and runtime semantics.excel_grapher/grapher/— workbook loading, graph extraction, Excel write-back, and visualization logic.excel_grapher/evaluator/— FormulaEvaluator: an Excel emulator for recomputing formulas in the extracted graph in Python.excel_grapher/exporter/— CodeGenerator: an transpiler for exporting the extracted graph as a standalone Python library.
Typical imports:
from excel_grapher.grapher import create_dependency_graph, DependencyGraph
from excel_grapher.evaluator import FormulaEvaluator
from excel_grapher.exporter import CodeGenerator
from excel_grapher.core import XlError # and other shared types, if neededInstallation
The Excel Grapher code is released under the MIT license. Install from GitHub:
Using uv (recommended):
## Basic install (NumPy-free)
uv add git+https://github.com/Teal-Insights/excel-grapher
## With vectorized operator / SUMPRODUCT acceleration
uv add "excel-grapher[fast] @ git+https://github.com/Teal-Insights/excel-grapher"
## With NetworkX support
uv add "excel-grapher[networkx] @ git+https://github.com/Teal-Insights/excel-grapher"
## With the HTML graph viewers (NumPy + NetworkX layouts, Graphviz)
uv add "excel-grapher[viz] @ git+https://github.com/Teal-Insights/excel-grapher"
## With all optional dependencies (includes `fast`)
uv add "excel-grapher[all] @ git+https://github.com/Teal-Insights/excel-grapher"Using pip:
pip install git+https://github.com/Teal-Insights/excel-grapher
## With extras:
pip install "excel-grapher[fast] @ git+https://github.com/Teal-Insights/excel-grapher"
pip install "excel-grapher[networkx] @ git+https://github.com/Teal-Insights/excel-grapher"
pip install "excel-grapher[viz] @ git+https://github.com/Teal-Insights/excel-grapher"
pip install "excel-grapher[all] @ git+https://github.com/Teal-Insights/excel-grapher"The default install is correct without NumPy. Install the fast extra when evaluating large workbooks and you want vectorized operator / SUMPRODUCT acceleration. Exported standalone code stays NumPy-free either way.
The author-bindings agent skill is not in the library wheel. Copy it into the consumer project. From a git clone or the excel-grapher sdist:
mkdir -p .agents/skills
cp -R skills/author-bindings .agents/skills/author-bindingsClaude Code uses .claude/skills/author-bindings. User-level installs go under ~/.agents/skills/author-bindings. The optional excel-grapher-author-bindings package is only a file source for that copy.
High-level usage
The library supports a three-stage pipeline, plus Excel write-back of the same graph views used for Python export:
- Build a dependency graph from an Excel workbook (
excel_grapher.grapher). - Evaluate formulas with Excel semantics over that graph (
excel_grapher.evaluator.FormulaEvaluator). - Export standalone Python (excel_grapher.exporter.CodeGenerator) and/or a new
.xlsxfrom the same GraphReadView (excel_grapher.grapher.write_workbook).
A minimal end‑to‑end example:
from pathlib import Path
from excel_grapher.grapher import create_dependency_graph, write_workbook
from excel_grapher.evaluator import FormulaEvaluator
from excel_grapher.exporter import CodeGenerator
from excel_grapher.series_bindings import load_series_bindings
workbook_path = Path("model.xlsx")
targets = ["Sheet1!A10"]
## 1) Build a dependency graph
graph = create_dependency_graph(workbook_path, targets, load_values=True)
print(len(graph)) # number of visited nodes
## 2) Evaluate with Excel semantics
with FormulaEvaluator(graph) as ev:
results = ev.evaluate(targets)
## 3a) Export a standalone Python package (requires series bindings)
bindings = load_series_bindings(workbook_path.with_suffix(".bindings.yaml"))
with CodeGenerator(graph) as gen:
modules = gen.generate_modules(
series_bindings=bindings,
bindings_workbook=workbook_path,
)
## 3b) Write a new workbook from the graph (or a ProjectionResult)
write_workbook(graph, Path("edited.xlsx"))Series bindings
Optional sidecar manifests (.bindings.yaml) declare structured input/output APIs for exported code — inverted-tree compute_* functions over named tensors and scalars (as_records for a Records view). Validate sidecars from the shell with excel-grapher bindings validate. Authoring agents should follow the Authoring series bindings skill and the same audit / burndown / upsert CLI. See the Series bindings guide and Code export guide.
User guide
Detailed documentation lives in the User Guide:
| Topic | Page |
|---|---|
| Dependency graphs | Read guide |
| Visualization | Read guide |
| Formula evaluation | Read guide |
| End-to-end demo | Read guide |
| Series bindings | Read guide |
| Authoring bindings | Read guide |
| Code export | Read guide |
| Parity testing | Read guide |
| Contributing | Read guide |
Examples
Hands-on walkthroughs (Markdown on GitHub):
| Topic | Walkthrough |
|---|---|
| Graph extraction | extraction_basics.md |
| Graph evaluation | codegen_basics.md |
| Series bindings | series_bindings.md |
| Induced graph | induced_graph.md |