Last checked: 25 November 2026
Short answer: use three nodes. A Gmail Trigger with Simplify turned off and Download Attachments on, a Split Out node on $binary so each attachment (attachment_0, attachment_1…) becomes its own item, and a Google Drive node with File › Upload. Below is the exact setup, the pitfalls that break it after a week, and when a dedicated tool is simpler.
Free plan, no card · Never sends or deletes email · Only attachments are saved
The workflow is the same on both. What changes is the Google connection and who runs the server.
Gmail Trigger → Split Out ($binary) → Google Drive (File › Upload)
Add a Gmail Trigger with your Google credential. Under Poll Times choose a mode such as Every X (for example every 5 minutes) or Custom. The event is Message Received.
In Filters, narrow it down: Search accepts Gmail search syntax, for example has:attachment filename:pdf, and you can also filter by Label Names or IDs or Sender. Max Emails per Poll defaults to 10 (maximum 50); extra matches wait for the next poll.
This is the step most tutorials skip. Simplify is on by default, and while it is on the Options collection is hidden. Turn Simplify off, then add Options › Download Attachments (default off) and switch it on. Leave Attachment Prefix at its default attachment_: n8n appends an index starting at 0, so an email with three files produces binary properties attachment_0, attachment_1 and attachment_2 on a single item.
The Google Drive upload reads one binary property per item, so split them first. Add a Split Out node and set Field to Split Out to $binary. It outputs one item per binary property, and each item keeps its original key (attachment_0, attachment_1…). Set Include to All Other Fields if you want the email's subject and sender available downstream.
Add a Google Drive node, Resource File, Operation Upload. Because the property name differs per item, use expressions:
Input Data Field Name: {{ Object.keys($binary)[0] }}
File Name: {{ $binary[Object.keys($binary)[0]].fileName }}
Parent Drive: My Drive
Parent Folder: (pick your folder: From list / By URL / By ID)
Run it once with a test email, check the file in Drive, then activate (publish) the workflow so the trigger starts polling.
If you prefer every item to carry its file under the usual data name (so the Drive node can use data as Input Data Field Name and {{ $binary.data.fileName }} as File Name), replace Split Out with a Code node set to Run Once for All Items:
const out = [];
for (const item of $input.all()) {
for (const [key, file] of Object.entries(item.binary ?? {})) {
out.push({
json: { ...item.json, attachmentKey: key, fileName: file.fileName },
binary: { data: file },
});
}
}
return out;
On self-hosted n8n, if your OAuth consent screen uses the External user type, the app starts in Testing mode. Only accounts you add as test users can sign in, and both n8n's docs and Google's OAuth documentation say refresh tokens in that state expire after 7 days. Your workflow then fails silently until you reconnect. Fixes: use an Internal app if you are on Google Workspace, publish the app, or reconnect the credential when it expires. Also make sure the Gmail API is enabled in the project; n8n lists a 401 "Client is unauthorized" error as the typical symptom when it isn't.
The trigger's Read Status filter defaults to Unread emails only. If you read an invoice on your phone before the next poll, it may never trigger. For filing, set it to Unread and read emails.
The Gmail Trigger polls on your schedule; it is not instant. On n8n Cloud, each poll that finds mail runs the workflow, and each run counts as an execution, so a short interval plus a busy inbox adds up.
The trigger keeps a timestamp cursor and remembers message IDs at the boundary to avoid delivering the same email twice. Duplicates still appear in practice when you re-run executions by hand, run a backfill that overlaps the live trigger, or copy the workflow. Google Drive happily stores two files with the same name. Common guards: add a Gmail node (Message › Add Label, e.g. saved-to-drive) after the upload and exclude it in the trigger search with -label:saved-to-drive, or search the folder for the file name before uploading.
Looking at n8n's source code, the trigger's first poll starts from the current time, so only mail arriving after activation is processed. A manual test run returns just the latest matching message. For history, build a separate workflow: Manual Trigger → Gmail node, Message › Get Many, Simplify off, Download Attachments on, a Search like has:attachment and Received After/Received Before dates → the same Split Out and Drive nodes. Get Many returns 50 messages by default (Limit can go up to 500, or use Return All), so work through large mailboxes in date ranges.
The workflow above saves files flat. Sorting by supplier, year or document type means adding IF/Switch nodes, folder lookups or an AI step, and maintaining those rules yourself.
n8n is a great fit if you are a developer or ops person who wants custom logic: post a Slack message when a contract arrives, parse invoice fields into a database, rename files with your own scheme, or chain this into a bigger automation. Self-hosting keeps data on your own server.
A dedicated tool is simpler if the goal is just "every attachment, filed in the right folder, without thinking about it". That is what Inbox2Drive does:
| n8n workflow | Inbox2Drive | |
|---|---|---|
| Setup | Google OAuth (self-hosted), 3+ nodes, expressions | Connect mailbox and storage |
| Old emails | Separate Get Many workflow | Included |
| Folder sorting | Whatever you build | Automatic, by AI |
| Mailboxes | Gmail node (other nodes for IMAP/Outlook) | Gmail, Outlook, IMAP |
| Maintenance | Yours | None on your side |
| Custom logic | Unlimited | Focused on saving attachments |
What Inbox2Drive doesn't do: it only saves attachments. It never sends or deletes your emails. There is a free plan with no card required.
Comparing other automation tools? Read our Zapier alternative for email attachments to Google Drive, the Power Automate alternative to save email attachments, or why a Gmail filter alone can't save attachments to Drive.
Yes. Use a Gmail Trigger with Simplify turned off and the Download Attachments option on, split the attachments into separate items with a Split Out node on $binary (or a Code node), and upload each one with the Google Drive node's File › Upload operation.
The Options collection that contains Download Attachments and Attachment Prefix only appears when Simplify is turned off. Simplify is on by default.
On self-hosted n8n with your own Google OAuth app, an External app in Testing publishing status gets refresh tokens that expire after 7 days. Reconnect the credential, use an Internal app on Google Workspace, or publish the app. n8n Cloud users can use n8n's managed OAuth instead.
No. On its first poll the trigger starts from the current time, so it only picks up mail that arrives after the workflow is active. For older emails, run a separate workflow with the Gmail node's Message › Get Many operation, a search such as has:attachment and Download Attachments enabled.
If you don't need custom logic, a dedicated service such as Inbox2Drive connects Gmail, Outlook or IMAP, processes past and new attachments, classifies them with AI and saves them into folders in Google Drive, OneDrive or Dropbox, with nothing to host or maintain. It has a free plan with no card.
Questions about your setup? Email marketing@inbox2drive.com and we'll help you by email.
Last checked: 25 November 2026 against n8n's official documentation, its public source code and Google's developer documentation. Node options and plan limits change between versions; follow the links for the current wording.
Connect Gmail on the free plan, pick Google Drive, OneDrive or Dropbox, and let past and new attachments land in the right folder on their own.
Create a free accountFree plan, no card · Never sends or deletes email · Help by email at marketing@inbox2drive.com