work / spreadsheet decompiler / in production
rebar
A decompiler for business-critical spreadsheets: every dependency mapped, every hidden error found, exported as code.
Formula parser, dependency analysis engine, code generator
1 · the workbook
| B2 | =C2*D2 |
|---|---|
| B3 | =C3*D3 |
| B4 | 4250 |
| B5 | =C5*D5 |
2 · the graph
one pasted number feeds the total
3 · the code
def line_total(
qty: float,
rate: float,
) -> float:
# from B2:B5
return qty * rate- Of formulas parsed and mapped
- 100%
- Of formulas parsed and mapped
- Classes of structural error detected
- 7
- Classes of structural error detected
- Output checked against the original workbook
- 1:1
- Output checked against the original workbook
Open the workbook nobody dares to touch.
Almost every established business has one: a workbook that prices the jobs, sizes the bids or forecasts the year, built by someone years ago and extended by everyone since. It works, nobody fully understands it, and the company can't afford for it to be wrong. Rebar is built to open that workbook up.
It reads the file the way a compiler reads source code. It parses every formula, maps how every cell depends on every other cell, and runs static checks for the kinds of error that spreadsheets hide so well. It then produces two things: an audit of what is wrong or fragile, and a faithful translation of the model into ordinary code that can be tested, versioned and reviewed.
pass 0 · why
Why spreadsheets fail silently
Spreadsheet errors don't announce themselves. A formula copied down a column with one row pasted over as a hard number still shows a plausible number. A range that stops one row short of the data still sums. A lookup that falls back to the wrong match still returns something. Field audits of real-world spreadsheets have repeatedly found errors in a large share of them, and the ones that matter are the ones nobody has looked at in years.
The usual fix, someone senior clicking through cells, doesn't scale past a few tabs. Inspecting a 40-tab model by hand means holding a dependency graph of tens of thousands of cells in your head.
pass 1 · parse and map
Decompiling the workbook
- formulas
- defined names
- tables
- data validation
- cross-sheet references
- shared formulas
A modern .xlsx file is a zip archive of XML. Rebar reads it directly, not through Excel, and recovers the formulas, defined names, tables, data validation and cross-sheet references, including the shared formulas that Excel compresses on save. Each formula is parsed into an abstract syntax tree using a full grammar for Excel's formula language, covering array formulas, structured references and LAMBDA and LET.
From those trees Rebar builds a directed graph of every cell-to-cell dependency in the workbook. That graph is what makes everything else possible. It shows which inputs actually drive a given output, which cells nothing depends on, and the exact order in which the model calculates.
pass 2 · static checks
What the audit catches
- E1Hard-coded numbers where a formula should be
- E2Formulas that break the pattern of the rows around them
- E3Ranges that miss part of the data they cover
- E4Circular references, intended or not
- E5Lookups that can silently return the wrong match
- E6Inputs that feed nothing
- E7Outputs that rest on one unchecked assumption
The static analysis looks for seven kinds of problem. Hard-coded numbers sitting where a formula should be. Formulas that break the pattern of the rows around them. Ranges that miss part of the data they're meant to cover. Circular references, intended or not. Lookups that can silently return the wrong match. Inputs that feed nothing, and outputs that rest on a single unchecked assumption.
Each finding is shown on a map of the workbook and ranked by how much downstream value depends on it. A wrong number feeding the total bid price outranks a wrong number in an unused scratch tab.
pass 3 · generate
From cells to code
generated == original
Once the graph is clean, Rebar generates code from it: typed functions with named inputs and outputs, in place of cell addresses. Typed Python or TypeScript is the default. The generated model is then run against the original workbook across many input sets and has to reproduce the same numbers before it is handed over, so the translation is proven rather than assumed.
What comes out can live in version control, be covered by tests, run behind an API, and be read by someone who wasn't there when it was built. The business keeps its logic and loses the fragility.
Output.

[1] Workbook map: every tab and cross-sheet dependency, coloured by the value downstream of its findings.

[2] Findings ranked by downstream value across the seven error classes, with the cell neighbourhood for the top one.

[3] One hard-coded cell in a formula column: the pattern it breaks, its parsed neighbour and what depends on it.

[4] Generated, typed code with the cell range each function came from, and the parity run against the original workbook.
Where it stands
Rust · OOXML parsing · Formula grammar and AST · Graph analysis · Python / TypeScript code generation · Property-based testing
Parsing, dependency-graph recovery and the core error checks work on large real-world workbooks. The code generator handles the large majority of common functions and is being extended to the long tail, including volatile functions, dynamic arrays and the odder corners of the date functions.
Next is the interactive graph explorer: click any number in the original workbook and trace exactly what produced it, down to the input cells, as a single view.
Join the Rebar beta waitlist
Have a workbook your business can't afford to get wrong? Tell us what it does (pricing, forecasting, planning) and roughly how big it is. Files are analysed privately and never shared.