Extract invoice and PO data from Gmail PDFs to XML, CSV and JSON with Google Drive
Ready for 3.0What this workflow does
This workflow has 17 nodes and runs on Gmail events (plus 1 other trigger). Along the way it connects Google Drive and Gmail.
How it runs
Trigger: On Gmail events (plus 1 other trigger).
- Split PDF Attachments (Code): runs custom JavaScript code
- Sample Invoice Text (Code): runs custom JavaScript code
- Extract Text from PDF (Extract from File): extracts data from a file (pdf)
- Parse Document Fields (Code): runs custom JavaScript code
- Attach Email Metadata (Code): runs custom JavaScript code
- Validate Document (Code): runs custom JavaScript code
- Workflow Configuration (Edit Fields (Set)): sets 3 fields: uploadToDrive, driveFolderId, reviewerEmail
- Is Valid? (If): checks a condition and branches into true / false
- Only Gmail Messages (Filter): keeps only the items that match a condition
- Build XML CSV JSON Files (Code): runs custom JavaScript code
…plus 5 more steps. See the full node list below.
Services it uses
Other Gmail + Google Drive templates (465)
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) (Watch Gmail for Invoice PDFs).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (9)
- Manual Trigger
n8n-nodes-base.manualTrigger - Code
n8n-nodes-base.code - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Google Drive
n8n-nodes-base.googleDrive - Gmail
n8n-nodes-base.gmail - Filter
n8n-nodes-base.filter - Gmail Trigger
n8n-nodes-base.gmailTrigger - Extract from File
n8n-nodes-base.extractFromFile
From the author
Quick overview This workflow monitors Gmail for unread invoice or purchase order PDFs, extracts text from each attachment, parses and validates key fields with rule-based logic, and outputs structured XML, CSV, and JSON files with optional Google Drive upload…