AutomationFlowsEmail & Gmail › Gmail Attachment Backup to Google Drive

Gmail Attachment Backup to Google Drive

ByAkhil Varma Gadiraju @akhilv7 on n8n.io

This n8n workflow automatically backs up email attachments from a specific sender in Gmail to a designated folder in Google Drive. It polls Gmail every minute and uploads any new attachments from matching emails to the specified Google Drive folder with a timestamped filename.

Event trigger★★★★☆ complexity8 nodesGmail TriggerGmailGoogle Drive
Email & Gmail Trigger: Event Nodes: 8 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #4243 — 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 →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "9b0e3c5c-6f27-4034-b281-960b039b883a",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -20
      ],
      "parameters": {
        "filters": {
          "sender": "user@example.com"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c68ebbfb-8fad-4f2b-837b-fb8ac0ffe4df",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        220,
        -20
      ],
      "parameters": {
        "simple": false,
        "options": {
          "downloadAttachments": true,
          "dataPropertyAttachmentsPrefixName": "attachment_"
        },
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "40b97338-6ffe-4cfd-869e-a50815808a89",
      "name": "Replace Me",
      "type": "n8n-nodes-base.noOp",
      "position": [
        800,
        -20
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0d4ae5a5-51d5-4917-8a88-7828d2f0e5ea",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        620,
        -20
      ],
      "parameters": {
        "name": "={{ $('Gmail Trigger').item.json.id + \"_\" + $now + \"_\" + \"backup_attachment\" }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1aZmIqT9jG-GqW_OIGT3HWvRb6JalTlBi",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1aZmIqT9jG-GqW_OIGT3HWvRb6JalTlBi",
          "cachedResultName": "DOcs"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "3f2bd52a-7637-4b65-bae3-daebc5f664de",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        420,
        -20
      ],
      "parameters": {
        "jsCode": "return Object.entries(items[0].binary).map(([key, value]) => {\n  return {\n    binary: {\n      data: value\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "c0ae6ad0-7f25-4912-9bbd-7610ef61d6cd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 260,
        "height": 80,
        "content": "### Change sender filter\nModify the sender field in the Gmail Trigger node"
      },
      "typeVersion": 1
    },
    {
      "id": "0552dd8a-341e-4a67-ad12-8bab41371685",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        140
      ],
      "parameters": {
        "color": 4,
        "height": 180,
        "content": "### Change destination folder \nUpdate folderId in the Google Drive node\n\n### Modify filename format\nEdit the name expression in the Google Drive node"
      },
      "typeVersion": 1
    },
    {
      "id": "f19c4cff-b85d-4ac3-99d7-bf70e61fe5bb",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -140
      ],
      "parameters": {
        "height": 100,
        "content": "### Add post-upload logic\nReplace or extend the Replace Me node with notifications, logs, etc."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replace Me": {
      "main": [
        []
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Replace Me",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow automatically backs up email attachments from a specific sender in Gmail to a designated folder in Google Drive. It polls Gmail every minute and uploads any new attachments from matching emails to the specified Google Drive folder with a timestamped filename.

Source: https://n8n.io/workflows/4243/ — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

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

Gmail, Slack, Gmail Trigger +3
Email & Gmail

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

N8N Nodes Htmlcsstopdf, Postgres, HubSpot +4
Email & Gmail

📩🤖 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.

Gmail Trigger, Google Drive, Execute Workflow Trigger +1
Email & Gmail

Teams that receive documents via email (invoices, receipts, contracts) and want structured data automatically extracted and added to a spreadsheet - without manual data entry.

Gmail Trigger, Gmail, N8N Nodes Docupipe +2
Email & Gmail

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

Gmail Trigger, Google Drive, Google Sheets +1