Extract and validate invoice PDFs with OpenAI, Google Sheets, and Gmail
Ready for 3.0What this workflow does
This workflow has 11 nodes and runs when someone submits an n8n form (“Invoice PDF Processor”). Along the way it connects Google Sheets and Gmail. It also calls api.openai.com over HTTP.
How it runs
Trigger: When someone submits an n8n form (“Invoice PDF Processor”).
- 2. Extract From File — PDF to Text (Extract from File): extracts data from a file (pdf)
- 3. HTTP — AI Extract Invoice Fields (HTTP Request): calls api.openai.com (POST)
- 4. Code — Parse Invoice JSON Safely (Code): runs custom JavaScript code
- 5a. Sheets — Log Invoice Header (Google Sheets): append
- 5b. Split Out — Line Items (Split Out): splits a list into separate items
- 6. Code — Add Unique Key and Line Metadata (Code): runs custom JavaScript code
- 7. Sheets — Log Each Line Item (Google Sheets): append
- 8. Aggregate — Collect All Line Items (Aggregate): combines items into one
- 9. Code — Verify Totals and Build Report (Code): runs custom JavaScript code
- 10. Gmail — Send Extraction Report (Gmail): uses Gmail
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
HTTP calls to: api.openai.com
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.
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (8)
- n8n Form Trigger
n8n-nodes-base.formTrigger - Extract from File
n8n-nodes-base.extractFromFile - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - Google Sheets
n8n-nodes-base.googleSheets - Split Out
n8n-nodes-base.splitOut - Aggregate
n8n-nodes-base.aggregate - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow collects an invoice PDF via an n8n Form, extracts text from the PDF, uses OpenAI to convert it into structured invoice JSON, logs invoice headers and line items to Google Sheets, validates totals, and emails a formatted extraction…