The original is one click away. Open original ↗
Automating expense tracking with AI, Google Drive, and Google Sheets
Executive overview
Manually itemising receipts and logging expenses wastes hours each month. Dropping any receipt file into a watched folder triggers an automated pipeline that extracts, categorises, renames, and logs the expense — no manual entry required.
The core insight: a file-watcher plus a vision model plus a spreadsheet writer eliminates all manual expense work at the point of capture.
How the automation works
- Any image or PDF dropped into a Google Drive parent folder (or subfolder) triggers a watcher
- Gemini Flash 2.0 extracts date, merchant, amount, category, and purchase rationale from the receipt
- Rationale is inferred by the model from context clues (merchant type, time, location) — not read from the receipt
- Categories are supplied as a fixed list; the model picks the closest match
- The file is renamed to
merchant_name + dateformat, replacing the default camera filename - Extracted data is written as a row into the correct monthly tab in a Google Sheets expense tracker, with a link back to the Drive file
Building it with AI: three lessons
- Start a new Cursor Composer conversation after each micro-feature — context window degradation hurts output quality over time
- Reference live API docs when integrating services like Google Sheets; it resolves auth and insertion bugs faster than iterating blind
- For recurring errors, ask the AI to analyse root cause before suggesting fixes — prompt it to assess the full codebase and propose no fixes until the cause is agreed
Prompting strategy: PRD-first development
- Write an initial plain-English brief, then send it to a reasoning model (e.g. o3-mini) to generate a PRD (product requirements document)
- Structure the PRD as phases with numbered micro-steps, each with a checkbox — this keeps the AI navigating macro-to-micro without getting lost in detail
- Include explicit model versions, folder structure, sheet/tab naming conventions, and column schemas in the brief — AI coding tools have training cutoffs and will default to stale APIs otherwise
- Specify the runtime target (e.g. macOS launchd/plist for a persistent local process)
Test-driven development as a reinforcement loop
- For each micro-step, instruct the AI to write the unit test before writing the function
- A failing test feeds structured error output back into the next iteration — the model self-corrects toward a passing test
- This creates a reinforcing feedback loop that reduces accumulated errors across phases
More like this — when you're ready for early access.
Join the waitlist for a personal account and content recommendations based on what you're working on.
No spam. Unsubscribe at any time.
You're on the list. We'll be in touch before launch.