Direct answer: A spreadsheet engine is three systems in one package: a data grid, a formula dependency graph, and a recalculation scheduler. Get the graph and the evaluation order right and every visible number stays current, which is the entire promise users rely on.

Open any spreadsheet and you see a grid of cells. Under it sits an engine most users never notice, one that records which formulas watch which cells and recomputes them in the right order. Building that engine, as the Univer team does in TypeScript, means writing all three layers yourself.

The trending query dream-num/univer climbed GitHub Trending (TypeScript) in late November 2026, and the project rewards a close look: dream-num/univer packages a full spreadsheet engine as an embeddable open-source library. The recalculation rules are the actual product, and once you can read a sheet as a dependency graph, the same shape shows up in build systems and in reactive UI frameworks.

Three systems under one grid

A spreadsheet is three systems stacked together. The data grid stores what you typed. The dependency graph records which cells watch which: a cell holding =C3+D3 watches C3 and D3. The scheduler evaluates in dependency order, so C3 lands before the cell that adds it.

The order is the hard part. Recalculating everything after each keystroke feels fine at a hundred formulas and stalls at a hundred thousand, so real engines recompute only the cells an edit touched, walking the graph in sequence:

  1. A keystroke lands in a cell.
  2. The engine re-edges the graph around it.
  3. Affected cells get sorted in dependency order, a topological sort.
  4. They evaluate one by one, pushing new values downstream.
  5. Untouched cells keep their values.
Edit one cellUpdate graphTopological sortRecomputetouched onlyUntouched cells keep their values.

The cycle is the classic trap

Put =B1+1 into A1 and =A1+1 into B1 and the graph holds a loop that a naive evaluator would chase forever. Graph theory supplies the classic fix: cells that reach each other group into strongly connected components, and any component with more than one cell, or with a self edge, is a cycle.

Spreadsheets report a cycle as an error inside the cell while the rest of the sheet stays computable. Catching the loop at graph build time and marking the offending cells is a design worth copying in any system that evaluates dependencies.

missedyour Brain mapquiz yourselfmasteredWatch your weak spots turn green.

Drop in your PDF - it doesn't leave your device.
Every miss becomes a red node on your map.
Free plan: 21 nodes, no card, no countdown.

Open Brain - free
NaN

Collaborative editing adds a second hard problem: two people typing at once, each expecting the edit to survive. Systems handle it with operational transforms or with CRDTs, conflict-free replicated data types that merge concurrent edits into the same result on every client.

A second common design lets a server order the operations and broadcast the sequence, so clients apply edits in one agreed order and converge. Either way the merge unit is small (set cell C4 to 12) and the merge rule must land every client on an identical sheet, which is why the algebra matters more than the network code.

Why the engine is the product

Spreadsheets are the most-used programming environment in the world, and most of their users have never heard the word runtime. Whoever controls the engine controls the extension points: custom functions, custom cell types, scripting hooks.

An open-source engine moves those points into public hands, so a team can embed a full sheet with its own formulas inside its own app. The lesson is that the grid was never the product; the contract that every visible number stays current is what people actually adopt.

Key takeaways

  • A spreadsheet is a data grid, a formula dependency graph, and a recalculation scheduler working as one system.
  • Recalculation follows dependency order, so an edit recomputes only the cells it touches.
  • Cycles such as A1=B1+1 with B1=A1+1 are caught as strongly connected components and shown as cell errors.
  • Collaboration leans on CRDTs or server-ordered operations so concurrent edits converge to one identical sheet.
  • An open engine puts the extension points, from custom functions to embedding, into public hands.

Quick answers

What is a spreadsheet engine?
The layer under the grid that stores cells, tracks formula dependencies, and schedules recalculation.

What happens with a circular reference?
The engine finds the loop while building the graph and marks those cells with an error instead of computing forever.

How do two people edit one sheet at once?
Through CRDTs or server-ordered operations that merge concurrent edits into an identical result everywhere.

Why rebuild a spreadsheet from scratch?
To own the extension points: custom functions, custom cell types, and embedding the sheet inside another product.

Where does the same design reappear?
In build systems and reactive UI frameworks, which also recompute the dependents of a changed value.

One thing to do tonight

Open any blank sheet, put =B1+1 into A1 and =A1+1 into B1, and watch the engine catch your loop within a second. If that five-second experiment lands, a browse through the Univer repository is the natural next step.