Save email attachments to Dropbox
Attachments from incoming emails are filed into Dropbox automatically.
How it works
Trigger: Gmail — new email with an attachment
- Watch Gmail for emails with attachments.
- Give each file a dated name.
- Upload it to a Dropbox folder.
Diagram
Trigger App Code
Code
JavaScript used in the Code step — already included in the template below.
// Splits every attachment into its own item and gives it a sortable file name:
// 2026-09-26-supplier.com-invoice.pdf
const out = [];
for (const item of $input.all()) {
const date = new Date(item.json.date).toISOString().slice(0, 10);
const sender = item.json.from?.value?.[0]?.address || "unknown@unknown";
const domain = sender.split("@")[1];
for (const file of Object.values(item.binary || {})) {
out.push({
json: { fileName: `${date}-${domain}-${file.fileName}` },
binary: { data: file },
});
}
}
return out;Build it
Pick your tool — same automation, step by step.
Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.
Show code (107 lines)
{
"name": "Save email attachments to Dropbox (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## Save email attachments to Dropbox\nAttachments from incoming emails are filed into Dropbox automatically.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "22e0658a-6dcb-4de5-a18f-ec87e4a044c1",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
},
"simple": false,
"filters": {
"q": "has:attachment"
},
"options": {
"downloadAttachments": true
}
},
"id": "22e0658a-6dcb-4de5-a18f-ec87e4a044c1",
"name": "Email with attachment",
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.2,
"position": [
0,
0
]
},
{
"parameters": {
"jsCode": "// Splits every attachment into its own item and gives it a sortable file name:\n// 2026-09-26-supplier.com-invoice.pdf\nconst out = [];\n\nfor (const item of $input.all()) {\n const date = new Date(item.json.date).toISOString().slice(0, 10);\n const sender = item.json.from?.value?.[0]?.address || \"unknown@unknown\";\n const domain = sender.split(\"@\")[1];\n\n for (const file of Object.values(item.binary || {})) {\n out.push({\n json: { fileName: `${date}-${domain}-${file.fileName}` },\n binary: { data: file },\n });\n }\n}\n\nreturn out;"
},
"id": "22e0658a-6dcb-4de5-a18f-ec87e4a044c1",
"name": "Split attachments",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
0
]
},
{
"parameters": {
"operation": "upload",
"path": "=/Email attachments/{{ $json.fileName }}",
"binaryData": true,
"binaryPropertyName": "data"
},
"id": "22e0658a-6dcb-4de5-a18f-ec87e4a044c1",
"name": "Upload to Dropbox",
"type": "n8n-nodes-base.dropbox",
"typeVersion": 1,
"position": [
600,
0
]
}
],
"connections": {
"Email with attachment": {
"main": [
[
{
"node": "Split attachments",
"type": "main",
"index": 0
}
]
]
},
"Split attachments": {
"main": [
[
{
"node": "Upload to Dropbox",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}In Make, create a new scenario and add these modules in order:
- Gmail › Watch Emails (search: has:attachment)
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Dropbox › Upload a File
- Every module run uses Make operations — the free plan includes a monthly quota.
- Make's built-in functions (map, sum, formatDate…) can replace most Code steps; for complex logic use a code module.
- Module and step names can differ slightly as Make and Zapier update their apps.
In Zapier, create a new Zap and add these steps in order:
- Gmail — New Email Matching Search (has:attachment)
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Dropbox — Upload File
- Zaps with more than two steps need a paid Zapier plan.
- Webhooks, Filters/Paths and Code by Zapier are premium features on some Zapier plans.
- Code by Zapier runs JavaScript: reuse the code shown above, reading inputs from inputData instead of $json.
- Module and step names can differ slightly as Make and Zapier update their apps.
Tips
- Narrow the search (e.g. from:accounting@) so only useful files are saved.
Related flows
ProductivityMedium
AI daily news digest
Every morning, AI summarises the latest articles from a news feed into one short email.
RSS → AI model → Gmail5h/mo
ProductivityMedium
Turn labelled emails into Notion tasks
Label an email "To-do" and it becomes a Notion task with a link back to the email.
Gmail → Notion3h/mo
ProductivityMedium
AI drafts replies to your emails
AI writes a reply draft for every new email — you just review and hit send.
Gmail → AI model12h/mo