Route Gmail PDF attachments with pdfRest OCR and Google Drive
UnknownWhat this workflow does
This workflow has 39 nodes and runs on Gmail events. Along the way it connects Gmail, Google Drive and Pdfrest (community). It also calls api.pdfrest.com over HTTP.
How it runs
Trigger: On Gmail events.
- Configure and split PDF attachments (Code): runs custom JavaScript code
- One attachment per review (Loop Over Items (Split in Batches)): loops over the items in batches
- Check attachment before processing (Code): runs custom JavaScript code
- Attachment within limit? (If): checks a condition and branches into true / false
- Record attachment held (Code): runs custom JavaScript code
- Inspect attachment text (Extract from File): extracts data from a file (pdf)
- Create restricted audit receipt (Code): runs custom JavaScript code
- Detect pages that need OCR (Code): runs custom JavaScript code
- Save restricted receipt (Google Drive): upload (file)
- Add OCR? (If): checks a condition and branches into true / false
…plus 28 more steps. See the full node list below.
Services it uses
Other Gmail + Google Drive templates (465)
HTTP calls to: api.pdfrest.com
Before you upgrade to n8n 3.0
We can't fully verify this one: it relies on 1 community package, and n8n 3.0 turns unverified community packages off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
- Check that @pdfrest/n8n-nodes-pdfrest is verified or supports 3.0 (used in Add searchable text).
- Also check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (9)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - If
n8n-nodes-base.if - Extract from File
n8n-nodes-base.extractFromFile - Pdf Rest
@pdfrest/n8n-nodes-pdfrest.pdfRest - HTTP Request
n8n-nodes-base.httpRequest - Google Drive
n8n-nodes-base.googleDrive - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow watches Gmail for emails with PDF attachments, extracts per-page text to detect scanned documents, runs OCR via pdfRest when needed, classifies each PDF using keyword rules, and uploads the file to the appropriate Google Drive…