Skip to product information

n8n Gmail PDF Invoice OCR & AI Extract to Google Sheets

n8n Gmail PDF Invoice OCR & AI Extract to Google Sheets

 (200+Reviews)
Regular price £23.99
Regular price £23.99 Sale price
SAVE Sold out
Instant Digital Download
Unlimited Downloads
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
23 people viewing
High interest right now
9 added today
Fast-moving digital product
n8n Gmail PDF Invoice OCR & AI Extract to Google Sheets

n8n Gmail PDF Invoice OCR & AI Extract to Google Sheets

Regular price £23.99
Regular price £23.99 Sale price
SAVE Sold out

Turn IKEA-style PDF invoices from Gmail into structured Google Sheets—automatically

This n8n workflow watches your Gmail inbox for unread invoice emails from a specific sender, saves the attached PDFs to Google Drive, runs OCR with Mistral, and uses Google Gemini to extract structured invoice data—then appends invoice headers and line items into Google Sheets.

What this workflow does

  • Monitors Gmail every minute for unread messages from a configured sender (and applies a Gmail label after processing).
  • Downloads attachments and splits the email into one item per attachment.
  • Filters to PDFs only by checking the MIME type.
  • Routes and archives invoices in Google Drive based on a filename prefix, then downloads the archived PDF for OCR.
  • Runs OCR with Mistral by uploading the PDF to the Mistral Files API, retrieving a signed URL, waiting briefly, and submitting the document URL to the Mistral OCR API.
  • Extracts structured invoice data with Google Gemini by sending the OCR text to a Gemini chat model and parsing the returned JSON (invoice summary + line items).
  • Writes to Google Sheets: appends invoice summary fields to the Invoices tab and each line item to the Invoice_Items tab.
  • Marks the email as handled by adding the configured Gmail label.

Use cases

  • Automate extraction of invoice totals, vendor details, and line items from PDF invoices sent via email.
  • Reduce manual work for SaaS operations and finance teams by keeping Google Sheets up to date from inbox activity.
  • Build a lightweight invoice ingestion pipeline using n8n, OCR, and AI extraction—without changing how invoices are delivered.

Technical details

  • Trigger: Gmail (checks every minute for unread messages from a specified sender).
  • Processing: filter, switch, code (splits attachments, validates PDFs, parses/cleans Gemini JSON, generates invoice ID).
  • Storage: Google Drive (archives PDFs to a target folder).
  • OCR: Mistral Files API + Mistral OCR API (signed URL flow).
  • AI extraction: Google Gemini chat model (structured JSON output).
  • Outputs: Google Sheets (Invoices and Invoice_Items tabs).
View full details