This workflow corresponds to n8n.io template #4977 — we link there as the canonical source.
This workflow follows the Gmail → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "9rIwaQlNKOLLs6Yi",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Email to Folder",
"tags": [],
"nodes": [
{
"id": "f0c308d6-9347-441b-a78b-b25de884f942",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-340,
220
],
"parameters": {
"simple": false,
"filters": {},
"options": {
"downloadAttachments": true
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "54a70814-0185-420b-a7e7-66ed811fae3c",
"name": "Google Drive1",
"type": "n8n-nodes-base.googleDrive",
"position": [
1040,
220
],
"parameters": {
"name": "={{ $json.id }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "={{ $node[\"Create Folder\"].json.id }}"
},
"inputDataFieldName": "={{ $binary.keys()[0] }}"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "435c21d8-7d23-447d-a081-a4991ba42a41",
"name": "Create Folder",
"type": "n8n-nodes-base.googleDrive",
"position": [
380,
160
],
"parameters": {
"name": "=Motion - {{ $node[\"Gmail Trigger\"].json.subject || \"Untitled\" }} - {{ $now }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
},
"resource": "folder"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"executeOnce": true,
"typeVersion": 3
},
{
"id": "3acb5376-3528-4a30-9612-67bd1a509adc",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-420,
-20
],
"parameters": {
"color": 6,
"width": 1700,
"height": 660,
"content": "Take PDF from Email and create a new folder with PDF "
},
"typeVersion": 1
},
{
"id": "e4aef0db-b072-4dc7-80e0-cd3658555bda",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"position": [
-120,
220
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "87e927b3-4f28-4843-b2d0-cf7269437fca",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $('Gmail Trigger').item.binary}}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4218230f-ccd0-4b8b-a4b3-54749ce8a738",
"name": "Gmail1",
"type": "n8n-nodes-base.gmail",
"position": [
100,
220
],
"parameters": {
"simple": false,
"options": {
"downloadAttachments": true
},
"messageId": "={{ $node[\"Gmail Trigger\"].json.id }}",
"operation": "get"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "833ab358-ce62-4acf-847e-0251bfb8e123",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
700,
220
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineAll"
},
"typeVersion": 3.1
},
{
"id": "55de30ff-40de-4b51-b5bd-0c00fbba80be",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
380,
360
],
"parameters": {
"options": {
"includeBinary": true
},
"fieldToSplitOut": "$binary"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "5d7c63e5-67f2-483d-8ebe-0c90967a1137",
"connections": {
"Merge": {
"main": [
[
{
"node": "Google Drive1",
"type": "main",
"index": 0
}
]
]
},
"Filter": {
"main": [
[
{
"node": "Gmail1",
"type": "main",
"index": 0
}
]
]
},
"Gmail1": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
},
{
"node": "Create Folder",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Create Folder": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"Google Drive1": {
"main": [
[]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleDriveOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is designed to automate the process of handling emails with binary attachments. It triggers when a new email arrives in a specified Gmail account (or can be configured with a similar email trigger) and is set to download any binary attachments. The workflow then…
Source: https://n8n.io/workflows/4977/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This template is built to be customized for your specific needs. This template has the core logic and n8n node specific references sorted to work with dynamic file names throughout the workflow. Store
This is an elite enterprise-grade solution for Talent Acquisition and HR Ops teams. It automates the high-volume task of resume screening by transforming unstructured PDF applications into structured
📩🤖 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.
Teams that receive documents via email (invoices, receipts, contracts) and want structured data automatically extracted and added to a spreadsheet - without manual data entry.
Freelancers, finance teams, and small businesses that receive invoice PDFs by email and want them automatically saved to Google Drive and logged in Google Sheets—without manual downloading or copy-pas