Every small business owner knows the feeling: it is tax time and you are digging through months of supplier emails, fuel receipts, and coffee invoices trying to remember what each one was for. The fix is not a new app. It is a one-time build that files expenses automatically while you are busy doing actual work.
This weekend, build a pipeline that turns forwarded or emailed receipts into a clean, categorized Google Sheet. Forward the receipt, and in two seconds you have a new row with the vendor, amount, date, and category already filled in.
What you are building
The flow is simple. A receipt arrives in your email inbox — a PDF from a supplier, a PayPal confirmation, a scanned photo from your phone. Your automation picks it up, sends the content to an AI for extraction, and appends a row to a Google Sheet with these columns:
- Date — when the purchase happened
- Vendor — who you paid
- Amount — total and tax, if visible
- Category — Fuel, Supplies, Meals, Software, Equipment, or Other
- Notes — any extra context the AI pulls from the document
- Source — the original email subject line or filename, so you can trace it back
By Sunday evening you will have a live expense log that grows on its own. Walk into your next quarterly review, or your accountant's office, with actual data.
What you will need
The stack is intentionally simple:
- n8n — a source-available workflow automation platform you can run free on your own machine or a cheap server. Launch it in seconds with
npx n8n(requires Node.js) or Docker. - Gmail — or any IMAP email. You will create a label called receipts and forward anything worth tracking to your inbox with that label.
- Google Sheets — one sheet with the column headers above. n8n's Google Sheets node handles the append.
- An AI API key — n8n connects to OpenAI, Anthropic Claude, or Google Gemini out of the box. Google Gemini 2.5 Flash has a free API tier that handles this kind of extraction easily.
If you prefer to skip the setup entirely, Zapier has a pre-built template for this exact flow. It takes about thirty minutes to configure and requires no self-hosting, though it counts against your monthly task limit.
Build it: the five-node workflow
n8n publishes a community workflow template for automated expense tracking with AI and Google Sheets that you can import directly. Here is what each step does so you understand the pieces when something breaks:
- Gmail trigger — watches for emails arriving with your receipts label. In n8n, the Gmail trigger node polls every minute (or uses a push webhook if you configure OAuth).
- Extract content — if the email has a PDF or image attachment, pull the file data. If it is a plain-text receipt from a payment processor, the email body is enough. n8n's Extract from File node handles PDFs; images go to the AI node directly.
- AI extraction — pass the content to an AI node with a structured prompt. Ask it to return only JSON with the fields you need. A prompt like the one below works well across a wide range of receipt formats:
Extract the following from this receipt and return only valid JSON. { "vendor": "...", "date": "YYYY-MM-DD", "amount": "...", "tax": "...", "category": "Fuel | Supplies | Meals | Software | Equipment | Other", "notes": "..." } If any field is unclear or missing, use the string "unknown". - Parse JSON — add a Code node to pull the AI's JSON response into named fields. One line:
return JSON.parse($input.first().json.text); - Append to Google Sheets — add a row using the parsed fields. Include a timestamp and a direct link to the original email so you can always pull the source document.
The whole flow takes under an hour to set up. Once it is running, each receipt processes in two to three seconds.
Four upgrades worth adding
Once the basics work, these additions turn a useful tool into a genuinely good one:
- Photo receipts from your phone. Create a dedicated email address like receipts@yourbusiness.com that forwards to your main inbox with the receipts label. When you snap a receipt in the field, email the photo. The AI handles image input just as well as PDFs for most standard receipts.
- Monthly summary email. Add a schedule trigger that fires on the first of each month, reads the Sheets data from the past month, and sends you a plain-text summary: total spent, breakdown by category, top five vendors. This is the report your accountant actually wants.
- Flag unusual spend. Add an IF node after extraction. If the amount exceeds a threshold you set, send a Slack message or email alert so nothing slips through unreviewed.
- Duplicate guard. Before appending a row, check whether a receipt from the same vendor on the same date already exists in the sheet. Prevents double entries when you forward an email twice or receive the same confirmation from two addresses.
Why this is worth doing now
Modern AI models are genuinely good at document extraction. A receipt — even a blurry photo, a foreign-language invoice, or a cluttered two-column PDF — yields clean structured data with a well-written prompt and a capable model. A year ago this pipeline needed a dedicated OCR service and significant prompt engineering. Today the AI node does most of the heavy lifting out of the box.
This is not a replacement for proper accounting software as your business grows. But for a sole proprietor or small crew, a self-filling Google Sheet beats a shoebox of receipts every time. Build the pipeline once, forward receipts as you go, and walk into tax season with data instead of dread.
