GenAiHub

Last checked 23 October 2026 — responded normally.

Extract invoice data from Gmail PDF invoices with Gemini and Google Sheets

Quick overview

Live
Open / InstallLast updated October 23, 2026

Description

Quick overview This workflow monitors a Gmail label for unread emails with PDF invoice attachments, extracts the PDF text, uses Google Gemini to parse key invoice fields into structured JSON, and appends the cleaned results to a Google Sheets tab before marking the email as read. How it works Polls Gmail every minute for unread emails matching the query has:attachment filename:pdf label:invoices and downloads attachments. Splits each matching email into separate items so each PDF attachment is processed individually. Extracts text from each PDF attachment using n8n’s PDF text extraction. Sends the email context and extracted text to Google Gemini with a predefined JSON schema to return structured invoice fields and a confidence score. Normalizes dates and numbers, checks basic consistency (like subtotal + tax vs total), and flags low-confidence or incomplete results as needs_review. Appends the final invoice row (including line items as JSON) to the Invoices sheet in Google Sheets and marks the source Gmail message as read. Setup Create or choose a Gmail label (for example, invoices) and ensure invoice emails are labeled to match the workflow’s Gmail search query. Add Gmail OAuth2 credentials for the Gmail Trigger and Gmail node. Add a Google Gemini (Google AI Studio) API key/credentials for the Gemini Chat Model. Add Google Sheets OAuth2 credentials and replace REPLACE_WITH_YOUR_SPREADSHEET_ID, ensuring your spreadsheet has a tab named Invoices. Test with a text-based PDF invoice (not image-only) or add an OCR step upstream if your invoices are scanned images. Additional info Need it installed? I set this up in your n8n on Fiverr, starting around $20: https://www.fiverr.com/mouwah/set-up-a-tested-n8n-invoice-approval-or-lead-routing-workflow-in-your-n8n Pro version (vendor PAY/HOLD check against a Vendors tab, duplicate detection, approval flow): https://mohabaha0.gumroad.com/l/ap-invoice-triage-pro. An n8n automation workflow template by Mohamed Zaghloul.

Community Metrics

Views
1
Avg Rating
N/A
Ratings
0
Likes
0
Comments
—

Author

Mohamed Zaghloul

Platform

web

Pricing model

free

Categories

  • Automation
  • AI

Tags

  • n8n
  • workflow
  • google-sheets
  • gmail
  • code
  • basic-llm-chain
  • structured-output-parser
  • google-gemini-chat-model

Capabilities

  • 6 nodes
  • 1 views

Information

TypeWorkflow
Sourcen8n
AddedOctober 21, 2026

Comments

?

Others in the same category, ranked by how often they are opened.