GenAiHub

Last checked 24 November 2026 — responded normally.

Extract and validate invoice PDFs from email with OpenAI, Sheets and Xero

Quick overview

Live
Open / InstallLast updated November 24, 2026

Description

Quick overview This workflow monitors an IMAP inbox for invoice PDF attachments, extracts structured invoice fields with OpenAI, validates totals and dates, logs results to Google Sheets, and optionally creates draft bills in Xero while sending Slack alerts for duplicates, reviews, and failures. How it works Triggers when a new email arrives via IMAP (or runs manually with sample invoices for testing). Splits each email into one item per PDF attachment and ignores non-PDF attachments. Extracts text from each PDF and flags files with too little text as scanned invoices. For non-scanned PDFs, uses OpenAI with a structured JSON schema to extract invoice fields and line items from the PDF text. Validates required fields, checks that line items plus tax match the total within a tolerance, and rejects unreadable or future invoice dates. Looks up the vendor and invoice number in the Google Sheets “Invoices” tab to detect duplicates, then routes invoices to “Invoices” (ok), “Needs review” (with a reason), or a duplicate Slack alert. Appends ok invoices to Google Sheets and, if configured, creates a DRAFT accounts-payable invoice (bill) in Xero using the extracted line items. Posts Slack alerts for invoices needing review, duplicates, and any step failures while continuing to process other attachments. Setup Connect IMAP credentials for the mailbox that receives invoices and ensure the node is allowed to download attachments. Add an OpenAI credential for the LangChain OpenAI Chat Model used to extract fields. Create a Google Sheets spreadsheet with “Invoices” and “Needs review” tabs, connect Google Sheets credentials, and replace the spreadsheet URL/ID used by the read/append steps. Create a Slack incoming webhook and paste the webhook URL into the workflow configuration. (Optional) Connect Xero OAuth2 credentials, set your Xero tenant ID and an expense account code, and keep the tenant ID empty if you only want to log to Google Sheets. Review and adjust configuration values such as the OpenAI model ID, total tolerance, and minimum text character threshold for scanned PDFs. An n8n automation workflow template by Pushbuild.

Community Metrics

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

Author

Pushbuild

Platform

web

Pricing model

free

Categories

  • Automation
  • AI

Tags

  • n8n
  • workflow
  • google-sheets
  • http-request
  • code
  • basic-llm-chain
  • openai-chat-model
  • structured-output-parser

Capabilities

  • 6 nodes

Information

TypeWorkflow
Sourcen8n
AddedNovember 24, 2026

Comments

?

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