Organize Gmail attachments in Google Drive folders based on sender’s email
Ready for 3.0What this workflow does
This workflow has 16 nodes and runs on Gmail events (plus 2 other triggers). Along the way it connects Gmail and Google Drive.
How it runs
Trigger: On Gmail events (plus 2 other triggers).
- Upload attachment (Google Drive): uses Google Drive
- Get emails (Gmail): get many
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- Get email (Gmail): get
- Contain attachments? (If): checks a condition and branches into true / false
- Split Out: splits a list into separate items
- Search folders (Google Drive): work with file folder
- Get attachments (Code): runs custom JavaScript code
- Exist? (If): checks a condition and branches into true / false
- Merge: merges the data from its input branches
…plus 3 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) (Gmail Trigger).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (12)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Manual Trigger
n8n-nodes-base.manualTrigger - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Split Out
n8n-nodes-base.splitOut - Merge
n8n-nodes-base.merge - Google Drive
n8n-nodes-base.googleDrive - Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - Execute Sub-workflow
n8n-nodes-base.executeWorkflow - Gmail
n8n-nodes-base.gmail - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code
From the author
📩🤖 This workflow automatically processes emails received in Gmail, extracts their attachments, and organizes them into specific folders in Google Drive based on the sender's email address. Note: The workflow avoids duplicates by checking folder existence…