Skip to main content

Gmail attachment backup to Google Drive

Workflow preview

Workflow preview
100%
Gmail attachment backup to Google Drive preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Gmail Attachment Backup to Google Drive — n8n Workflow This n8n workflow automatically backs up email attachments from a specific sender in Gmail to a designated folder in Google Drive. It polls...

Best for

  • File Management automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, n8n-nodes-base.gmail, n8n-nodes-base.noop, n8n-nodes-base.googledrive, n8n-nodes-base.code, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Akhil Varma Gadiraju.

Original n8n.io source

1.1 Workflow description

Title
Gmail attachment backup to Google Drive
Workflow name
Gmail attachment backup to Google Drive

📥 Gmail Attachment Backup to Google Drive — n8n 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.


📌 Use Case

Primary Purpose:

  • Automatically archive and back up attachments from a specific sender (e.g., [email protected]) to Google Drive for safekeeping, audit, or processing.

Ideal For:

  • Automating invoice/receipt collection from a vendor
  • Archiving reports from a monitored email address
  • Creating a searchable historical log of attachments for compliance

🧭 Workflow Overview

Here’s how the workflow operates:

  1. 🔔 Gmail Trigger
    Polls Gmail every minute for new messages from a specific sender ([email protected]).

  2. 📩 Gmail Get Message
    Retrieves the full contents (including attachments) of the matched email.

  3. 🧠 Code (JS)
    Iterates over all binary attachments in the email and restructures them as individual binary items to upload separately.

  4. 📤 Google Drive
    Uploads each attachment to a target Google Drive folder (DOcs) with a timestamp and unique name.

  5. 📍 Replace Me (NoOp)
    Placeholder node to indicate workflow completion. You can replace this with Slack notifications, logs, or alerts.


🔧 How to Use

Prerequisites

  • An n8n instance (self-hosted or cloud)
  • A connected Gmail account with OAuth2 credentials
  • A connected Google Drive account with OAuth2 credentials
  • Permissions for n8n to access your Gmail and Google Drive

Setup Instructions

  1. Import the Workflow
    Copy and paste the workflow JSON into your n8n editor.

  2. Set Up Credentials
    Ensure the following credentials exist and are authorized:

    • `Gmail (for Gmail nodes)
    • `Google Drive (for Google Drive node)
  3. Configure the Folder
    Update the folderId in the Google Drive node if you want to use a different target folder.

  4. Activate the Workflow
    Enable the workflow in n8n. It will start polling Gmail every minute.


✏️ How to Customize

Task How to Customize
Change sender filter Modify the sender field in the Gmail Trigger node
Adjust polling frequency Change the pollTimes configuration in the trigger node
Change destination folder Update folderId in the Google Drive node
Modify filename format Edit the name expression in the Google Drive node
Add post-upload logic Replace or extend the Replace Me node with notifications, logs, etc.
Process only specific attachments Add logic in the Code node to filter by filename or MIME type

📂 Filename Format Example

[MessageID]_[Timestamp]_backup_attachment

This naming convention ensures uniqueness and traceability back to the original message.


✅ Future Improvements

  • Email subject filtering to narrow down the match
  • Slack/Email notifications after upload
  • Deduplication check to avoid reuploading the same files
  • Virus scan or file validation before upload

💬 Support

For any issues using this workflow:

  • Double-check your credential permissions
  • Review n8n logs for Gmail or Google Drive errors
  • Visit the n8n community forums

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 2 - Gmail

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 3 - Replace Me

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 4 - Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 5 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Gmail attachment backup to Google Drive
Complexity intermediate
Nodes 8
Categories File Management
Author Akhil Varma Gadiraju
Published 20 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4243/4243.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Gmail attachment backup to Google Drive do?

Gmail Attachment Backup to Google Drive — n8n Workflow This n8n workflow automatically backs up email attachments from a specific sender in Gmail to a designated folder in Google Drive. It polls...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your File Management use case.