I've built budget.xlsx, but I haven't recalculated it. LibreOffice isn't installed here, so Excel will calculate the formulas when you open the file. The script that generates it is build_xlsx.py, in the same folder.
What's in it
- Inputs sheet: the assumptions are in yellow cells and labelled "Sample". They are monthly income 4,500, rent 1,400, food 600, transport 250, utilities 200 and a savings goal of 15%.
- Budget sheet:
- Categories: rent, food, transport and utilities. Each amount is a formula pointing at the Inputs sheet (for example
=Inputs!B5), and each has a "% of income" column. - Totals: a total spent row (
=SUM(B4:B7)), income, and the remaining amount (income minus total spent). - Savings check: it compares the remaining amount with income × savings goal %. It shows "On track - surplus of …" or "Short by …".
- Categories: rent, food, transport and utilities. Each amount is a formula pointing at the Inputs sheet (for example
- Chart: a bar chart of spending by category, titled as sample, next to the table.
What I checked
- I reopened the saved file and confirmed there are two sheets, one chart, and no hard-coded numbers on the Budget sheet. Every amount and total is a formula.
- I read each formula's cell references by hand and they point at the right inputs.
- Working it out by hand with the sample numbers, total spent is 2,450, remaining is 2,050, and the savings goal is 675. The check should therefore read "On track - surplus of 1,375.00".
Not checked
- No recalculation, so I haven't seen the computed values or confirmed the chart renders correctly.
- If a number looks off when you open it, tell me.
Your call: the savings goal isn't counted as a spending category. It's only compared against what's left over. I can add it as a category if you'd rather see it in the total and the chart.
Test run: a sample household budget built with openpyxl in a temporary folder. The run was allowed to write files and run python3 only. The formulas were inspected by re-opening the file and by hand calculation, but not recalculated, because LibreOffice was not installed. Excel calculates them on opening. All numbers are sample.
What it does
Writes and runs a Python script that builds or changes a workbook so it behaves like a real spreadsheet. Calculations are formulas that refer to a labelled inputs sheet or named ranges, not numbers buried in formulas or pasted values. It sets header formatting, number formats, widths, frozen panes, data validation, conditional formatting and charts. Edits to an existing file start by listing sheets, formulas and named ranges, change only the requested cells, warn about what openpyxl can lose on save (pivot tables, slicers, some formats) and save under a new name. It can also audit a sheet for error values, numbers stored as text, hard-coded numbers in formulas and ranges that stop short of the data. openpyxl cannot recalculate, so it says whether formulas were recalculated or only inspected.
Output
The .xlsx file, the script, a verification report with what was and was not calculated, and the assumptions to confirm.
Good for
Budgets, trackers and report workbooks generated or fixed from data, and quick audits of a spreadsheet that shows errors.
Medium risk: instructions only, no scripts of its own, but it writes and runs Python that creates files in your working folder and may suggest installing openpyxl in a virtual environment. It never overwrites your original, creates no macros and adds no external links. Test-run once in a temporary folder with sample numbers: it built a two-sheet budget with formulas and a chart; the formulas were inspected and hand-checked but not recalculated because LibreOffice was missing. Excel calculates them on opening. Do not rely on it for financial or tax decisions. Original by AIBars (MIT).