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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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

  • Gmail Account: To watch for new emails and download attachments.
  • Google Drive Account: To store files uploaded automatically.
  • n8n Automation Platform: To build and run the workflow managing all steps.
  • OAuth2 Credentials: Needed for secure access to Gmail and Drive inside n8n.

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

  • Files correctly uploaded to Google Drive folder per size category.
  • Notifications or skips for files outside upload size range.

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.


Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free