# An AI gave me a confidently wrong spreadsheet total — so I built one where AI writes code, not guesses, and gets verified.

> Source: <https://dev.to/durlabh_kumar_a839a974273/an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-writes-code-not-1nf3>
> Published: 2026-08-18 20:50:06+00:00

A few months ago I asked an AI tool to total up a sales spreadsheet.

It gave me a clean, confident number.

It was wrong. Not "rounding error" wrong — it had quietly skipped

rows and produced a total that just *looked* plausible. Nothing

flagged it. Nothing hedged. It just said the number, like it was fact.

That's the actual problem with LLMs on tabular data: **they don't
calculate, they estimate.** Ask a model to sum a column and, under

So I built [Sheet Analysis AI](https://github.com/Durlabhkumarjha/sheet-analysis-ai)

specifically so it *can't* do that. Here's the actual mechanism —

not the marketing version.

When you ask a question like "which region grew fastest?", the

model doesn't see your data. It sees:

`region`

, `revenue`

, `date`

)From that, it writes a small piece of JavaScript — actual code, not

a natural-language answer. That code is then executed **locally, in
your browser**, against your

The model decides the *approach* (group by region, sum revenue,

sort descending). Your machine does the *calculating*. This alone

kills the "confidently estimated" failure mode, because there's no

estimation step left — it's just code execution.

The deterministic dashboard (KPIs, Mann-Kendall trend detection,

ANOVA seasonality, Pareto/RFM segmentation, forecasting) doesn't

even involve the AI — it's plain statistical code that runs the

instant you upload a file, no API key required at all.

Even code-generated numbers can be wrong — bad logic, an edge case,

a misread column. So before anything renders, a separate

deterministic auditor — no AI involved — re-checks every figure

against the source rows. A concrete example:

Say your data is:

| Region | Product | Revenue |
|---|---|---|
| North | Phone | 200 |
| North | Laptop | 200 |
| South | Phone | 100 |
| South | Laptop | 500 |

Total revenue is $1,000. The auditor checks this a few different ways:

`400 / 1000`

, or a plausible-sounding guess?`400 + 600 = 1000`

. By product:
`300 + 700 = 1000`

. If those don't match, something's broken
upstream and the number is blocked, not shown.Any single failed check blocks that figure. It doesn't get

downgraded to "approximately" — it just doesn't render.

To be upfront about scope:

React 19 + TypeScript + Vite. No backend in this build — parsing,

analysis, and the reconciliation gate all run client-side.

Licensed AGPL-3.0.

I don't think this needs to be a product. I think the *pattern* —

AI proposes the method, deterministic code executes it, a separate

auditor verifies it before display — is generally useful for anyone

building "AI + your data" tools, and it's more useful to more people

as a reference than as a SaaS with a handful of users.

Repo: [https://github.com/Durlabhkumarjha/sheet-analysis-ai](https://github.com/Durlabhkumarjha/sheet-analysis-ai)

Genuinely curious if anyone's solved this "AI + real numbers" trust

problem differently — would love to compare notes in the comments.
