Overview
Bookkeepers still copy line items from PDFs by hand. Vision-capable LLMs eliminate that job — including for handwritten receipts. This workflow turns any inbox into a structured invoice ledger in Google Sheets, with confidence scores so humans review only the uncertain ones.
How it works
- IMAP trigger monitors an accounting@ inbox for messages with attachments.
- Attachments are filtered to PDF / PNG / JPG and passed to GPT-4o with a strict JSON schema.
- The model returns vendor, invoice number, date, currency, subtotal, tax, total, and line items.
- Confidence < 0.85 → routed to a 'Review' sheet; otherwise → appended to the main ledger.
- Original file is uploaded to Google Drive with a link stored in the row.
Benefits
- Kills a 4-hour weekly bookkeeping task.
- Structured line items — not just totals — mean better category analytics.
- Confidence-based routing keeps humans in the loop only where it matters.
Use cases
- SMBs with 20-200 invoices/month.
- Consultancies handling client expense receipts.
- Anyone whose bookkeeper still asks 'can you send me the PDF?'
Step-by-step guide
Step 1: Set up a dedicated inbox
accounting@yourdomain — vendors and forwarding rules go here. Never point this at a personal inbox.
Step 2: Filter attachments precisely
Reject anything > 10MB and anything not PDF/PNG/JPG. Multi-page PDFs need conversion to images before vision calls.
Step 3: Design the JSON schema first
Match your accounting software's field names exactly. Retro-fitting later means every historical row needs migration.
Step 4: Ask for confidence per field
Not just per invoice. If the total is high-confidence but the tax line is low, that's exactly the review signal you want.
Step 5: Route by confidence
≥0.85 → main sheet. <0.85 → review sheet. Weekly, sample review-sheet rows to tune the threshold.
Step 6: Archive originals
Upload every file to Drive under /invoices/YYYY/MM/. Store the link in the row for auditability.
Example
Row: 2026-05-14 | Acme Cloud | INV-8821 | USD 1,248.00 (subtotal 1,155.00, tax 93.00) | 4 line items | conf 0.94 | drive.google.com/…