Templates / Extract invoice and receipt data from Gmail PDFs to Google Sheets with OpenAI

Extract invoice and receipt data from Gmail PDFs to Google Sheets with OpenAI

Ready for 3.0

by Ziad Karim ✓ · 99 views · created 2026-08-12 · Invoice Processing, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-12-01.

📬 Weekly n8n 3.0 breakage alerts, free

What this workflow does

This AI workflow has 14 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model and Google Sheets.

How it runs

Trigger: On Gmail events.

  1. Check for PDF Attachment (If): checks a condition and branches into true / false
  2. Extract PDF Text (Extract from File): extracts data from a file (pdf)
  3. Extract Invoice Fields with AI (Basic LLM Chain): sends a prompt to an LLM, with model: AI Invoice Analyzer
  4. Validate AI Invoice Data (Code): runs custom JavaScript code
  5. Read Invoice Number from Sheets (Google Sheets): read
  6. Determine Duplicate Status (Code): runs custom JavaScript code
  7. Check Invoice Logged Status (If): checks a condition and branches into true / false
  8. Assess Need for Manual Review (If): checks a condition and branches into true / false
  9. Send Manual Review Alert (Gmail): uses Gmail
  10. Append Invoice to Sheets Log (Google Sheets): append

Services it uses

GmailOpenAI Chat ModelGoogle Sheets

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

  • Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (When Invoice Email Received).

Nodes used (9)

From the author

Quick overview Emails with PDF attachments are parsed automatically: AI extracts vendor, invoice number, dates and amounts into Google Sheets — validated in code (net + tax vs total), deduplicated against the sheet, and doubtful extractions are emailed to you…

Excerpt from Ziad Karim's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.