Automate Gmail Attachments to Google Drive with n8n

Struggling to manually save Gmail attachments? This n8n automation listens for new emails with attachments, extracts each file, and uploads them automatically to your Google Drive, saving hours of tedious work and reducing errors.
gmailTrigger
function
googleDrive
Workflow Identifier: 1526
NODES in Use: Gmail Trigger, Function, Google Drive
Automate Gmail to Drive with n8n

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow helps you take email attachments sent to you and puts them into your Google Drive automatically.

It checks for new unread emails from a chosen sender, downloads each attachment separately, sorts files by size, and uploads medium or large files to a folder in Google Drive.

This saves time and stops you missing or losing files by handling everything without clicking yourself.


Tools and Services Used


Input → Processing → Output

Input

  • New unread emails in Gmail from a specific sender with file attachments.

Processing

  1. Trigger when such emails arrive.
  2. Split attachments to handle one by one, no matter their filename.
  3. Check each file’s size to decide what to do next.
  4. Send medium and large files to Google Drive upload.
  5. Take special actions for files too big or too small as needed.

Output


Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open your n8n editor, then click “Import from File” and select the downloaded workflow.

Step 2: Set Up Required Credentials

  1. Add your Gmail and Google Drive credentials with OAuth2 authentication if not done already.

Step 3: Update Workflow Settings

  1. Change email address filter to your sender if needed, inside the Gmail Trigger node.
  2. Update folder ID in the Google Drive node to match your preferred storage folder (replace the example ID).

Step 4: Test the Workflow

  1. Send yourself a test email with different size attachments from the configured sender address.
  2. Run the workflow manually or wait for the trigger to activate and check the results.

Step 5: Activate for Production

  1. Switch the workflow to Active mode in n8n so it runs automatically on new email arrivals.
  2. Make sure your n8n instance runs continuously or is set to poll Gmail frequently.

If hosting n8n yourself, visit self-host n8n for smooth running advice.


Detailed Workflow Structure

Trigger and Attachment Extraction

The Gmail Trigger node checks Gmail for new unread emails from a specific sender. It downloads attachments immediately.

The Split Out node takes all attachments and makes each file one item in the process. This is important to handle files one by one, no matter their names.

File Size Categorization

The Switch node examines each attachment’s size property.

Files are placed into three categories: large (over 300MB), medium (between 10MB and 300MB), and small (under 10MB).

Upload and Notification Actions

Medium files trigger a Google Drive upload node to save files in the specified folder using the original filename.

Large files connect to a NoOp node simulating a notification or alert for manual handling.

Small files connect to another NoOp node that ignores them (like icons or tiny images).


Common Problems and Fixes

  • No attachments found: Check if the Gmail Trigger filters use the correct sender’s email and that downloadAttachments is enabled.
  • Uploads fail: Verify Google Drive folder ID and OAuth2 credentials are accurate and current.

Workflow Customization Ideas

  • Change sender email filter to track attachments from other email addresses.
  • Modify the file size limits in the Switch node to fit storage or upload needs.
  • Replace NoOp notification nodes with real email or Slack alerts for large files.
  • Build logic to choose Google Drive folder based on attachment metadata dynamically.

Summary

✓ This workflow automatically moves email attachments from specific senders to Google Drive by file size.

✓ It saves hours by removing the need to manually download or upload attachments.

✓ Users avoid mistakes like lost files or wrong file placements.

→ Files are sorted into large, medium, or small and handled accordingly.

→ Medium and large files go into Drive, large files alert the user, and small files are ignored.


Automate Gmail to Drive with n8n

Visit through Desktop to Interact with the Workflow.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.