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.
하는 일
통합 문서를 만들거나 바꾸는 Python 스크립트를 쓰고 실행해 진짜 스프레드시트처럼 동작하게 합니다. 계산은 이름표가 붙은 입력 시트나 이름 정의를 참조하는 수식으로 하며, 수식에 숫자를 묻거나 값을 붙여 넣지 않습니다. 머리글 서식, 숫자 서식, 열 너비, 틀 고정, 데이터 유효성 검사, 조건부 서식, 차트를 설정합니다. 기존 파일을 고칠 때는 먼저 시트, 수식, 이름 정의를 나열하고, 요청한 셀만 바꾸며, 저장 시 openpyxl이 잃을 수 있는 것(피벗 테이블, 슬라이서, 일부 서식)을 경고하고, 새 이름으로 저장합니다. 오류 값, 텍스트로 저장된 숫자, 수식에 박아 넣은 숫자, 데이터를 다 덮지 못하는 범위도 점검할 수 있습니다. openpyxl은 다시 계산하지 못하므로 수식을 재계산했는지 살펴보기만 했는지 밝힙니다.
결과물
.xlsx 파일, 스크립트, 계산한 것과 하지 않은 것을 밝힌 확인 보고서, 확인이 필요한 가정.
이런 때 좋습니다
데이터로 예산, 추적 표, 보고용 통합 문서를 만들거나 고치려는 사람, 오류가 나는 표를 빠르게 점검하려는 사람.
중간 위험:지침만 있는 파일로 자체 스크립트는 없지만, Python을 쓰고 실행해 작업 폴더에 파일을 만들며 가상 환경에 openpyxl 설치를 권할 수 있습니다. 원본을 덮어쓰지 않고 매크로나 외부 링크를 만들지 않습니다. 임시 폴더에서 샘플 숫자로 한 번 시험했고 수식과 차트가 있는 두 시트짜리 예산을 만들었습니다. 수식은 점검과 손계산으로 확인했지만 LibreOffice가 없어 재계산은 하지 않았고, Excel에서 열면 계산됩니다. 재무나 세무 판단의 근거로 쓰지 마세요. AIBars 제작(MIT).