🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Gmail to Google Drive, attachments filed automatically

Lisa Granqvist Partner Workflow Automation Expert

Your inbox becomes a filing cabinet, and honestly, it’s a bad one. Attachments get downloaded “later,” renamed inconsistently, and then vanish into random folders (or worse, someone’s desktop).

This Gmail Drive attachments automation hits marketing managers first because assets arrive nonstop. But office admins and agency owners feel it too when receipts, contracts, and creative files are scattered across emails.

This workflow watches Gmail for new emails with attachments, extracts every file, and uploads them into Google Drive automatically. You’ll see what it does, why it matters, and how to adapt it to your folder rules.

How This Automation Works

See how this solves the problem:

n8n Workflow Template: Gmail to Google Drive, attachments filed automatically

The Challenge: Email Attachments That Never Get Filed

Attachments feel small until you count how often they show up. A vendor sends a signed PDF, a client replies with updated creative, someone forwards a spreadsheet you need for reporting. You download it, promise yourself you’ll “file it after this call,” and then the next email arrives. A week later you’re searching Gmail, Drive, Slack, and your downloads folder, trying five different filenames. Meanwhile, your Drive structure gets messier because everyone files things differently, which makes search less reliable over time.

It adds up fast. Here’s where it breaks down in real teams.

  • You spend about 5 minutes per attachment downloading, renaming, and choosing a folder.
  • Files get saved twice (or not at all), so version control becomes a guessing game.
  • Important docs sit in inboxes, which means teammates can’t find them without you.
  • One missed invoice or contract attachment turns into a “who has it?” thread that wastes everyone’s time.

The Fix: Auto-Extract Gmail Attachments into Google Drive

This workflow quietly does the boring part for you. It starts by monitoring your Gmail inbox for any new email that includes attachments. When one arrives, a small processing step extracts each attachment and turns it into a clean, iterable set of files (so multiple attachments in one email don’t get missed). Then Google Drive takes over, uploading each file as its own Drive item. The result is simple: every attachment is captured, stored, and searchable in Drive without you touching “Download.” It’s a lightweight setup, but the impact is big because it removes the daily drip of micro-tasks that interrupts real work.

The workflow begins with a Gmail trigger. Next, the Function step builds binary attachments so n8n can handle each file reliably. Finally, the Drive uploader pushes each attachment into Google Drive as a separate file.

What Changes: Before vs. After

Real-World Impact

Say your team receives 30 attachment-heavy emails a week, and each email has 2 attachments on average. If it takes about 5 minutes to download, name, and file each attachment, that’s roughly 5 hours of busywork weekly. With this workflow, the “work” is basically zero: Gmail triggers instantly, n8n extracts the files, and Drive uploads them in the background. You’ll still spend a minute here or there checking folders, but the grind disappears.

Requirements

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Gmail to detect new emails with attachments.
  • Google Drive to store attachments automatically.
  • Google OAuth credentials (create in Google Cloud Console).

Skill level: Beginner. You’ll connect Gmail/Drive and pick a target folder.

Need help implementing this? Talk to an automation expert (free 15-minute consultation).

The Workflow Flow

A new email with attachments arrives. The Gmail Trigger monitors your inbox and only fires when an incoming message includes attached files.

Attachments are extracted and prepared. A Function (code) step pulls out every attachment from the email and formats them as binary files that n8n can pass along cleanly, even when an email has multiple attachments.

Google Drive receives each file. The Drive upload step creates a file in your chosen Drive location for each extracted attachment, so nothing gets skipped.

Your team searches Drive, not inboxes. Once files land in Drive consistently, you can organize around folders and naming rules instead of “who has that email?”

You can easily modify the destination folder to match your client/project structure based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Gmail Trigger

Set up the trigger to watch for new emails that include attachments.

  1. Add and open New Email Monitor.
  2. Set the search filter q to has:attachment.
  3. Enable downloadAttachments to true so attachments are included in the binary data.
  4. Set pollTimes to run everyMinute.
  5. Credential Required: Connect your Gmail credentials.

You can keep Flowpast Branding as a visual note in the workflow canvas; it does not affect execution.

Step 2: Connect Google Drive

Prepare the destination where attachments will be stored.

  1. Open Drive File Uploader.
  2. Credential Required: Connect your Google Drive credentials.
  3. Confirm driveId is set to My Drive.
  4. Set folderId to root (or choose another folder if preferred).

Step 3: Set Up the Processing Node

Convert email attachment binaries into individual items for upload.

  1. Add and open Build Binary Attachments.
  2. Paste the functionCode exactly as provided in the workflow to loop through each binary attachment and output one item per file.
  3. Ensure Build Binary Attachments is connected from New Email Monitor and outputs to Drive File Uploader.

⚠️ Common Pitfall: If attachments are not downloaded in New Email Monitor, Build Binary Attachments will output empty results. Make sure downloadAttachments is enabled.

Step 4: Configure the Output Node

Define how uploaded files are named and saved in Google Drive.

  1. In Drive File Uploader, set name to ={{ $json.fileName.split(".")[0] + "-" + $('New Email Monitor').item.json.from.value[0].address + "." + $json.fileName.split(".")[1]}}.
  2. Verify that Drive File Uploader receives input from Build Binary Attachments.

Step 5: Test and Activate Your Workflow

Validate that attachments are captured and archived correctly before going live.

  1. Click Execute Workflow and send a test email with attachments to the monitored Gmail account.
  2. Confirm Build Binary Attachments outputs one item per attachment.
  3. Verify files appear in Google Drive with the filename pattern that includes the sender’s email address.
  4. Once successful, switch the workflow to Active to enable continuous monitoring.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Watch Out For

  • Gmail credentials can expire or need specific permissions. If things break, check the Gmail connection status in n8n’s Credentials section first.
  • If your Drive uploads “work” but files don’t appear where you expect, it’s usually the folder ID. Double-check the target folder in Google Drive and confirm the workflow is pointing at the right location.
  • Multi-attachment emails can include odd file types or unnamed attachments. If an upload fails, inspect the execution data for the attachment’s filename and MIME type and add a fallback naming rule in the Function step.

Common Questions

How quickly can I implement this Gmail Drive attachments automation?

Usually about 30 minutes if your Google accounts are ready.

Can non-technical teams implement this attachment filing automation?

Yes. No coding is required, because the template already includes the attachment extraction step. You mainly connect Gmail and Drive, then choose where uploads should go.

Is n8n free to use for this Gmail Drive attachments workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Google API usage (for most small teams, it’s effectively negligible).

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

How do I adapt this Gmail Drive attachments solution to my specific challenges?

You can. Most customizations happen in the Gmail Trigger (filtering which emails count) and in the Drive upload step (choosing a folder or naming pattern). Common tweaks include saving files into client-specific folders, adding a date prefix to filenames, and skipping attachments like logos in email signatures.

Why is my Gmail connection failing in this workflow?

Usually it’s expired OAuth consent or a permission mismatch. Reconnect your Gmail credentials in n8n, then rerun one test email to confirm the trigger can see your inbox. If it still fails, check if your Google Workspace admin restricts third-party access, and look for “insufficient permissions” messages in the execution logs. Rate limits are rare here, but they can show up if you’re processing a lot of emails at once.

What’s the capacity of this Gmail Drive attachments solution?

For most teams, it can run continuously without issues.

Is this Gmail Drive attachments automation better than using Zapier or Make?

Often, yes, if you need reliable multi-attachment handling. n8n gives you more control over how attachments are extracted and passed through, and you can self-host for unlimited runs if volume grows. Zapier or Make can be quicker for a simple “one attachment to one folder” use case, but edge cases (multiple files, weird filenames, filtering) tend to get messy. If you want a second opinion on fit, Talk to an automation expert.

Once attachments land in Drive automatically, your inbox stops being a storage system. Set it up once, then let the workflow do the filing while you get on with actual work.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal