How I Auto-Track SaaS Expenses from Gmail Receipts to a Spreadsheet
I pay for 8 SaaS tools. Every month, receipts arrive in Gmail and I forget to log them. At tax time I'm scrambling to find them all.
Now I run one prompt monthly that searches Gmail for receipts, extracts the amounts, and writes them into a Google Sheet. Took 30 minutes to set up once, saves hours every quarter.
What You'll Learn
- A copy-paste prompt that finds all your SaaS receipts in Gmail
- How to auto-extract service name, amount, and date into a spreadsheet
- Handling bilingual inboxes, Stripe receipts, and PDF attachments
The Prompt
You can copy this directly:
Search my Gmail for emails with subject containing "receipt" or "invoice" from the last 30 days. Read each one and extract: (1) Service name (2) Amount with currency (3) Date (4) Receipt/invoice number if visible. Append each as a new row to Google Sheet [spreadsheet_id], columns: Service, Amount, Date, Receipt Number.
The Gmail search query AI should use: subject:(receipt OR invoice) newer_than:30d
For bilingual inboxes (English + Chinese), you can copy this instead:
subject:(receipt OR invoice OR 帳單 OR 收據) newer_than:30d
Why It Works Well
💡 Search by subject, not body. Searching the full body catches too many false positives — marketing emails that say "get a receipt for your donation" or threads forwarding someone else's receipt. Subject-line search is precise: only emails specifically titled as receipts.
💡 Sheets append auto-finds the last row. You don't need to tell AI which row to write to. The append action takes the header range (like A1:D1) and automatically adds data after the last existing row. Run the same prompt every month without worrying about overwriting old data.
💡 Specify "Amount with currency". Without this, AI might extract "20" from a $20.00 receipt, losing the currency and decimals. With it, AI returns "USD $20.00" or "NT$490" correctly.
Real Example
✅ A Replit receipt email contains: "Replit Core Qty 1 $20.00 Total $20.00 Amount paid $20.00". AI correctly extracts:
- Service: Replit Core
- Amount: USD $20.00
- Date: 2026-03-17
- Receipt: #2136-0967
Two Things That'll Trip You Up
⚠️ Stripe-powered receipts all look the same. Replit, Anthropic, and many others send receipts through Stripe, so the sender address is something like [email protected]. AI might group them all as "Stripe" instead of the actual service. Fix: tell AI to extract the service name from the email body/subject, not the sender address.
⚠️ Some receipts are PDF attachments with no text in the body. The email just says "Your invoice is attached." AI can read the email text but usually can't read PDF attachments through the API. These get logged with the service name but "Amount: see attachment." Not perfect, but at least you know the receipt exists.
Setup
Needs Gmail + Google Sheets. Claude.ai has a Gmail connector but Sheets append needs full API access.
OctoDock connects both through one MCP URL — AI searches Gmail, extracts data, and appends to Sheets in one conversation.