{"slug": "an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-code", "title": "An AI gave me a confidently wrong spreadsheet total — so I built one where AI writes code, not guesses, and gets verified.", "summary": "A developer built Sheet Analysis AI, an open-source tool that prevents AI from hallucinating spreadsheet totals by having the model write JavaScript code that runs locally in the browser, with a deterministic auditor verifying every figure before display. The tool, built with React 19, TypeScript, and Vite, is licensed under AGPL-3.0 and aims to establish a pattern for trustworthy AI data analysis.", "body_md": "A few months ago I asked an AI tool to total up a sales spreadsheet.\n\nIt gave me a clean, confident number.\n\nIt was wrong. Not \"rounding error\" wrong — it had quietly skipped\n\nrows and produced a total that just *looked* plausible. Nothing\n\nflagged it. Nothing hedged. It just said the number, like it was fact.\n\nThat's the actual problem with LLMs on tabular data: **they don't\ncalculate, they estimate.** Ask a model to sum a column and, under\n\nSo I built [Sheet Analysis AI](https://github.com/Durlabhkumarjha/sheet-analysis-ai)\n\nspecifically so it *can't* do that. Here's the actual mechanism —\n\nnot the marketing version.\n\nWhen you ask a question like \"which region grew fastest?\", the\n\nmodel doesn't see your data. It sees:\n\n`region`\n\n, `revenue`\n\n, `date`\n\n)From that, it writes a small piece of JavaScript — actual code, not\n\na natural-language answer. That code is then executed **locally, in\nyour browser**, against your\n\nThe model decides the *approach* (group by region, sum revenue,\n\nsort descending). Your machine does the *calculating*. This alone\n\nkills the \"confidently estimated\" failure mode, because there's no\n\nestimation step left — it's just code execution.\n\nThe deterministic dashboard (KPIs, Mann-Kendall trend detection,\n\nANOVA seasonality, Pareto/RFM segmentation, forecasting) doesn't\n\neven involve the AI — it's plain statistical code that runs the\n\ninstant you upload a file, no API key required at all.\n\nEven code-generated numbers can be wrong — bad logic, an edge case,\n\na misread column. So before anything renders, a separate\n\ndeterministic auditor — no AI involved — re-checks every figure\n\nagainst the source rows. A concrete example:\n\nSay your data is:\n\n| Region | Product | Revenue |\n|---|---|---|\n| North | Phone | 200 |\n| North | Laptop | 200 |\n| South | Phone | 100 |\n| South | Laptop | 500 |\n\nTotal revenue is $1,000. The auditor checks this a few different ways:\n\n`400 / 1000`\n\n, or a plausible-sounding guess?`400 + 600 = 1000`\n\n. By product:\n`300 + 700 = 1000`\n\n. If those don't match, something's broken\nupstream and the number is blocked, not shown.Any single failed check blocks that figure. It doesn't get\n\ndowngraded to \"approximately\" — it just doesn't render.\n\nTo be upfront about scope:\n\nReact 19 + TypeScript + Vite. No backend in this build — parsing,\n\nanalysis, and the reconciliation gate all run client-side.\n\nLicensed AGPL-3.0.\n\nI don't think this needs to be a product. I think the *pattern* —\n\nAI proposes the method, deterministic code executes it, a separate\n\nauditor verifies it before display — is generally useful for anyone\n\nbuilding \"AI + your data\" tools, and it's more useful to more people\n\nas a reference than as a SaaS with a handful of users.\n\nRepo: [https://github.com/Durlabhkumarjha/sheet-analysis-ai](https://github.com/Durlabhkumarjha/sheet-analysis-ai)\n\nGenuinely curious if anyone's solved this \"AI + real numbers\" trust\n\nproblem differently — would love to compare notes in the comments.", "url": "https://wpnews.pro/news/an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-code", "canonical_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_at": "2026-08-18 20:50:06+00:00", "updated_at": "2026-08-18 21:14:13.298900+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "developer-tools", "ai-tools"], "entities": ["Sheet Analysis AI", "Durlabhkumarjha", "React", "TypeScript", "Vite", "AGPL-3.0"], "alternates": {"html": "https://wpnews.pro/news/an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-code", "markdown": "https://wpnews.pro/news/an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-code.md", "text": "https://wpnews.pro/news/an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-code.txt", "jsonld": "https://wpnews.pro/news/an-ai-gave-me-a-confidently-wrong-spreadsheet-total-so-i-built-one-where-ai-code.jsonld"}}