# Extracting Invoices From WhatsApp Photos With AI Vision (Apps Script + Google Sheets)

> Source: <https://dev.to/hayrullahkar/extracting-invoices-from-whatsapp-photos-with-ai-vision-apps-script-google-sheets-4nh5>
> Published: 2026-07-12 09:33:00+00:00

Every logistics and field-sales team runs the same expensive process: a driver photographs a receipt into a WhatsApp group, and a back-office clerk manually types the invoice number, total, and date into a spreadsheet. Hundreds of receipts a week = transcription errors and thousands of wasted hours.

AI vision models kill that bottleneck. Here's the pipeline that turns a blurry field photo into clean structured data in seconds.

OCR reads characters. Modern vision models (Claude Vision, Gemini Vision, GPT-4 Vision) read structure — they distinguish a tax ID from a total, and a date from an amount, even on crumpled, angled, or poorly lit receipts. No brittle per-vendor parsers.

```
WhatsApp image → Apps Script doPost → forward to vision model
  → model returns JSON { InvoiceNumber, TotalAmount, VendorName,
                         Date, Category, confidence_score }
  → confidence routing:
       > 90  → auto-append to ledger
       70–90 → flag for human review
       < 70  → ask driver to re-photo
  → write row to Google Sheet (+ link to original image)
  → auto WhatsApp confirmation to driver
```

The `confidence_score`

is the whole trick — it's what stops bad extractions from silently polluting your ledger.

Pattern: Gemini for the first pass, escalate only low-confidence cases to Claude / GPT-4o.

~500 receipts/week: vision API $10–40 + WhatsApp API $30–60 + Apps Script free = **~$40–100/month**. Versus a clerk at ~25 hrs/week = **$2,000–4,000/month** in loaded labor. Per-receipt cost: $0.005–0.02 (compress images to ~1024px to cut it further).

Accuracy: 92–97% on legible receipts, 75–85% on handwritten/damaged — hence the confidence routing.

The complete pipeline, categorization, and privacy controls are in the [full guide on the MageSheet blog](https://magesheet.com/blog/extracting-invoices-via-whatsapp-ai-vision).

Built by the MageSheet team.
