# Extract and validate Gmail invoice PDFs into Google Sheets with OpenAI

> Quick overview This workflow watches a Gmail label for invoice emails with PDF attachments, extracts the PDF text, uses OpenAI to pull structured invoice fields, validates totals and VAT logic, and then appends clean invoices to an Invoices tab in Google Sheets while routing failures to an Exceptions tab. How it works 1. Triggers every minute when a new Gmail message arrives under a specified label and has attachments, downloading the attachments for processing. 2. Filters the message to keep only PDF attachments. 3. Converts the PDF attachment into plain text. 4. Sends the extracted text to OpenAI to extract structured invoice data (supplier, invoice number, dates, currency, totals, VAT, and line items) using a strict schema. 5. Validates the extracted values by checking required fields, total reconciliation (net + VAT ≈ gross), line-item sums, allowed VAT rates, and flags negative totals. 6. Appends validated invoices to the Invoices sheet in Google Sheets and sends any non-reconcili

- **Domain**: `n8n-workflow-18603.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/18603
- Page (HTML): https://agenstry.com/agents/n8n-workflow-18603.n8n.io
- Documentation: https://n8n.io/workflows/18603
