An Airbnb Expense Ledger That Reads Receipts Overnight
A host scans receipts with their phone; overnight, an AI agent reads them and a Python script files them into an Excel ledger with tax categories, shared-cost allocation and Airbnb income. Here is how it is built, and what I would change.
A host in Canada rents out one basement room on Airbnb. The bookkeeping is small, but it is fiddly. A Costco run has guest towels and family groceries on the same receipt. Hydro, gas and internet serve the whole house, so only a share of each bill is a rental expense. The Airbnb export mixes reservations with payouts, and if you add both up you count the same money twice. At tax time, all of it has to land on the right lines of form T776.
Capturing the receipt is the easy part. The hard part is knowing that one receipt is partly guest supplies, or that a bill is only partly deductible, at a rate that can change during the year. So I built a small system around how the host already works: their phone, their OneDrive and a spreadsheet. This post walks through the design, the parts that broke, and what changes when the same idea has to cover several properties.
The constraints
- Capture has to be one step. If adding a receipt takes more than a tap and a folder choice, it doesn’t happen.
- Nothing goes in unchecked. AI reads the receipt; a person approves the row. Only approved rows count.
- Use what the host already has. Their phone, their OneDrive, Excel, and the Claude plan they already use. No new app to learn and no server to look after.
- The output is a file an accountant can open. That means Excel, with categories that match T776.
Two designs, and why the local one won
I built the cloud version first. A Google Apps Script bound to a Google Sheet ran every 15 minutes, sent new receipts to the Claude API with a JSON schema, and wrote rows back. It worked, but for one household it meant one more account, one more API key and one more bill to keep an eye on.
The second version runs on the host’s own PC as a scheduled Claude task at 9 pm. It runs on the Claude plan the host already uses, so there is nothing new to sign up for. The trade-off is real: the PC and the Claude app have to be on at 9 pm, or the run waits until the next time the app opens. For one household that is fine. For a business with several properties, I would choose differently (see the last section).
The same week, storage moved from Google Drive to OneDrive, because that is where the host already kept their Airbnb files. Because all paths live in one config file, the switch was a one-line change plus a re-run of init.
How it works
Press a scenario. The left side is the nightly run; the right side is the receipt row as it fills in, plus the run log.
Receipt row
- file
- —
- scope
- —
- vendor
- —
- total
- —
- tax
- —
- share
- —
- status
- —
- original
- —
run log
Airbnb income takes a shorter path: the CSV export goes into its own folder and ledger.py income imports it on the same nightly run (more on that below).
The folder is the classification
The host picks a folder when saving the scan:
| Folder | Meaning | Airbnb share |
|---|---|---|
Inbox/Airbnb | Only for the room or guests | 100% |
Inbox/Shared | Whole-house bills | Allocation percent in effect on the bill date |
Inbox/Mixed | Household and guest items together | Sum of the line items marked Airbnb |
This is the single most useful decision in the project. The AI is good at reading a receipt. It has no way to know which towels went to the guest room. The folder carries that knowledge at no extra effort, at the moment the host still remembers.
The agent is one stage, not the system
The scheduled task follows a short instruction file. It runs ledger.py pending, reads each listed image or PDF, writes one JSON file per receipt, and then runs ledger.py ingest. It never opens the workbook and never moves files. Python does all of that.
{
"file": "<inbox path>",
"vendor": "Costco Wholesale",
"date": "2026-10-18",
"subtotal": 84.97,
"gst_hst": 11.05,
"pst_qst": null,
"total": 96.02,
"category": "Guest supplies (9270 Other)",
"line_items": [{ "description": "Bath towels 6pk", "amount": 29.99 }],
"confidence": "high",
"notes": ""
}
The instructions have one firm rule: never guess a number you can’t read; use null instead. A blank cell is easy to spot in review. A wrong number that looks right is not.
ingest then validates the JSON, assigns an ID, flags duplicates, writes the receipt row and its line items, saves the workbook, and only after a successful save moves the original into Processed/<year>/. If anything fails before the save, nothing has moved and the next run picks the receipt up again.
The spreadsheet does the allocation
The Airbnb share of each receipt is a formula, not a stored number, so the host can change a scope or a percentage and every total updates:
=IF(Scope="Airbnb", Total,
IF(Scope="Shared", Total * <allocation % in effect on Date>,
IF(Scope="Mixed", Total * <Airbnb line items> / <all line items>,
0)))
Allocation rows have From and To dates. When the percentage changes, you add a row and close the old one, so last year’s bills keep last year’s percentage. For a Mixed receipt, the share is a ratio of line items, applied to the total. That way tax and discounts are split the same way as the items.
Income without double counting
The Airbnb CSV goes into Income CSV/. Every row gets a key, the hash of the whole row, so exporting overlapping date ranges is harmless. Payout rows stay in the sheet but count as zero revenue. Revenue comes from gross earnings on reservation rows, and the host service fee is tracked separately. If the export is missing a column the importer expects, it prints a warning instead of quietly writing zeros.
What broke, and the fix
The workbook is open in Excel. Excel on Windows locks an open workbook, so a save from Python fails. Both commands check for the lock first and stop cleanly with a message. Since files only move after a successful save, the receipts wait in the Inbox for the next run.
The same receipt, uploaded twice. It is easy to scan a paper bill and later also save the emailed PDF of the same bill. Each row stores a SHA-256 of the original file. A matching hash, or a matching vendor, date and total, marks the new row Possible duplicate. The script never deletes a duplicate for you; the host decides.
iPhone HEIC photos. The agent can’t read them. Rather than skipping them silently, pending turns any unsupported file into an Error row that says to use the OneDrive app’s Scan, which saves a PDF.
Status names are a data contract. Partway through, the host asked for the whole system in English instead of Vietnamese. Translating the code was the easy part. The real catch: the Dashboard formulas count rows where Status = "Approved". One existing row still saying Đã duyệt would have vanished from every total with no error at all. The migration backed up the workbook, then translated stored statuses, dropdown lists and the dashboard formulas together, and finished with a check that no Vietnamese text was left in any cell.
openpyxl and Excel features. openpyxl rewrites the whole file on save. Charts and images that someone adds in Excel are dropped. At one point the dropdown validations had gone missing from the live workbook too. The guide now says to keep charts in a separate workbook, the migration re-applied the validations, and a dated backup is taken before the first write of each day. Next time I would have ingest check the validations on every run, rather than only fixing them during a migration.
OneDrive conflict copies. If someone edits the ledger in Excel for the web while the PC is writing it, OneDrive will keep both versions as two files. There is no clean technical fix for one shared file, so the rule is simply “no edits around 9 pm”. This is the main reason the multi-property version below uses a database.
Takeaways
- Put human knowledge where it is cheapest to capture. One folder choice at scan time beats any amount of clever inference later.
- Let the agent read, and let code write. The AI turns a picture into JSON. Deterministic code decides what gets in, where it goes and when a file moves.
- Approve, don’t trust. Every row arrives as To review. The dashboard ignores anything that hasn’t been approved.
- Treat labels as part of the data. Anything a formula compares against is a contract. Renaming it is a migration, not a find-and-replace.
From one room to a portfolio
One room fits in one workbook. A host or property manager with several units needs more, and that is the version I now offer as a Multi-property Expense & Profit Dashboard:
- A property on every row. Receipts, line items, allocations and income all carry a property, so you get profit per unit, not just per household.
- A database behind the spreadsheet. Several people can review at once without conflict copies. Excel or Google Sheets stays as the view and the export.
- Payout reconciliation. Airbnb and Vrbo payouts are matched to bank deposits, so missing or short payouts show up as exceptions.
- A cloud run instead of a desktop task, so nothing depends on one PC being switched on.
The core loop stays the same: scan into a folder, the agent reads, code validates, a person approves.