57-second formula walkthrough video: https://www.youtube.com/watch?v=pftPAlYpABQ
When small-business founders ask a chatbot to write a 5-year financial model for an SBA loan or commercial lease, they almost always hit the same wall: the prose looks polished, the markdown tables look neat, and the accounting doesn't actually add up. Assets don't equal Liabilities plus Equity, debt amortization doesn't match the cash flow statement, and exporting to Excel gives you dead hardcoded numbers instead of live formulas.
To fix that in ProFormaPlan, we built a deterministic 60-month 3-statement accounting engine in TypeScript that compiles real OpenXML (.xlsx) workbooks directly inside Cloudflare Workers using nothing but fflate for ZIP compression—no heavy spreadsheet libraries, no headless LibreOffice container, and <15ms runtime per workbook.
You can download an actual 8-tab output right now without signing up and inspect the XML/formulas directly in Excel, LibreOffice, or Google Sheets:
- Free 8-tab 5-year sample
.xlsx(979 live formulas): https://www.proformaplan.com/samples/proformaplan-sample-5yr-model.xlsx - Live customizer (free 12-month
.xlsxfor your own numbers): https://www.proformaplan.com/?utm_source=devto&utm_campaign=openxml_article
Why Skip Heavy Excel Libraries in Edge Workers?
Popular Node .xlsx libraries pull in megabytes of polyfills, stream wrappers, and XML DOM abstractions that bloat Cloudflare Worker bundles or break in non-Node runtimes. Yet an .xlsx file is just a ZIP archive of straightforward XML files:
[Content_Types].xml _rels/.rels xl/workbook.xml xl/_rels/workbook.xml.rels xl/styles.xml xl/worksheets/sheet1.xml ... sheet8.xml Using fflate's synchronous zipSync, emitting all 8 linked worksheets with inline strings (t="inlineStr"), explicit style indices (xl/styles.xml), frozen panes, column widths, and both formula strings (<f>) and cached evaluated values (<v>) takes roughly 400 lines of plain TypeScript and produces a clean ~29 KB .xlsx.
The Two Rules That Keep 3-Statement Models Tied to $0.00
Most automated spreadsheets break balance-sheet reconciliation by month 3 because they treat the Income Statement, Cash Flow Statement, and Balance Sheet as separate tables instead of one closed double-entry loop.
1. Compute Every Monthly Ledger Period Deterministically First
For each month m = 0..60 (starting from Opening Balance Sheet M0 where owner equity + loan proceeds fund CapEx, startup expenses, initial inventory, and opening cash):
- Income Statement: Revenue (with seasonal curve and ramp), COGS, Gross Profit, Payroll + Payroll Burden, Fixed OpEx, Rent, Marketing, Depreciation (straight-line over useful life), Loan Interest (
openingDebt * monthlyRate), Pre-Tax Income, Income Tax (zero on losses), Net Income. - Working Capital: Accounts Receivable (
revenue * arDays / 30), Inventory (cogs * invDays / 30), Accounts Payable (cogs * apDays / 30). - Indirect Cash Flow:
Operating Cash Flow = Net Income + Depreciation - ΔAR - ΔInventory + ΔAPInvesting Cash Flow = -CapExFinancing Cash Flow = Loan Draw - Principal Repayment + Equity Injection - Owner DistributionsEnding Cash = Opening Cash + OCF + ICF + FCF
- Balance Sheet:
Total Assets = Ending Cash + AR + Inventory + Net PP&ETotal Liabilities = AP + Ending DebtTotal Equity = Contributed Capital + Retained Earnings- Audit invariant:
Math.abs(Total Assets - (Total Liabilities + Total Equity)) < 0.01across all 60 months.
In our test suite (tests/finance.test.ts), every single one of our 16 NAICS industry presets—plus edge cases like debt-free models and high-working-capital businesses—is asserted against that $0.00 invariant across all 60 monthly periods before deploy.
2. Emit Live Formulas (<f>) Alongside Cached Values (<v>)
One subtle .xlsx gotcha: if you emit <f>SUM(B6:M6)</f> without a <v> cached value, Excel recalculates on open, but mobile viewers, macOS Quick Look, and Python readers show blank cells or 0. Emitting both:
<c r="N6" s="8"> <f>SUM(B6:M6)</f> <v>1297175</v> </c> ensures that every viewer renders exact formatted dollar values immediately and clicking any total, gross profit, EBITDA, DSCR, or Balance Check cell in Microsoft Excel reveals the live formula and updates dynamically when a banker edits an assumption cell on Tab 1.
Avoiding the Biggest Trap in Narrative + Spreadsheet Generation
Once the 60-month math is locked, the prose business plan (editable .docx and typeset PDF) is generated strictly from that verified ModelOutput JSON—never letting a text model invent its own revenue, payroll, or DSCR figures. Every dollar in the Executive Summary, Use of Funds, and SBA Underwriting Memo reconciles penny-for-penny with Tab 1 through Tab 8 of the .xlsx.
If you're curious about the OpenXML output, grab the free 8-tab sample .xlsx (no signup) or try the 2027 budget generator at https://www.proformaplan.com/2027-budget and inspect the formula bar in Excel or LibreOffice. Feedback on formula compatibility or edge cases is always welcome.
