Save email attachments to Dropbox

Attachments from incoming emails are filed into Dropbox automatically.

Easy Saves ~3 hours/month ProductivityBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Gmail — new email with an attachment
  1. Watch Gmail for emails with attachments.
  2. Give each file a dated name.
  3. Upload it to a Dropbox folder.

Diagram

GEmail with attachme…Gmail Trigger{ }Split attachmentsCodeDUpload to DropboxDropbox
Trigger App Code

Code

JavaScript used in the Code step — already included in the template below.

Split attachments · Code node
// 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.

Workflow JSON
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": []
}

Open in the playground to edit →

Tips

  • Narrow the search (e.g. from:accounting@) so only useful files are saved.

Related flows