Integration with LangChain/LangGraph
A LangChain.js / LangGraph tool that gives your agents deterministic spreadsheet and formula computation — backed by HyperFormula’s Excel-compatible engine.
What it does
Section titled “What it does”- Evaluate formulas deterministically — your agent runs any Excel-compatible formula through HyperFormula instead of asking the LLM to do math. Results are exact, reproducible, and auditable.
- Read and write cells and ranges — the agent inspects, populates, or modifies sheet data through typed tool calls.
- Trace dependencies — precedents and dependents are surfaced so the agent can explain how every value was derived.
- 400+ built-in functions out of the box — the agent has access to the full Excel-compatible function set (
SUM,VLOOKUP,IRR,INDEX/MATCH, and the rest), no implementation work required.
Example
Section titled “Example”Wiring HyperFormula into a LangGraph ReAct agent:
import { ChatOpenAI } from '@langchain/openai';import { createReactAgent } from '@langchain/langgraph/prebuilt';import HyperFormula from 'hyperformula';import { createSpreadsheetTools } from 'hyperformula/langchain';
const hf = HyperFormula.buildFromArray([ ['Revenue', 100], ['Cost', 60], ['Profit', '=B1-B2'],]);
const agent = createReactAgent({ llm: new ChatOpenAI({ model: 'gpt-4o' }), tools: createSpreadsheetTools(hf),});
await agent.invoke({ messages: [ { role: 'user', content: 'What drives the profit number, and what happens if revenue doubles?' }, ],});A single import, one entry in tools, and the agent can evaluate formulas, read ranges, and edit cells through LangChain — without inventing numbers.
Use cases
Section titled “Use cases”- Explain the spreadsheet — ask the agent what a workbook does, which cells are inputs, and how each output is derived; get answers grounded in real formula evaluation.
- What-if scenarios and forecasting — the agent tweaks assumptions and reports how downstream results change, deterministically.
- Validate and clean data — the agent scans ranges for errors, missing values, or inconsistencies and fixes them in place.
- Generate formulas from natural language — the agent translates a plain-English calculation into a verified, working Excel formula.
- Financial modeling and reporting — NPV, IRR, amortization, KPI rollups, and other quantitative workflows where the answer must be exact and auditable.