Automatically Save Gmail Attachments to Google Drive for Freelancers
Every time a new email with an attachment arrives in Gmail, this workflow automatically saves the file to a specified Google Drive folder. Freelancers never lose a contract, invoice, or brief again.
- 1
Trigger: Watch Gmail for new emails with attachments
Add a
Gmail Triggernode. Connect it to your Google account via OAuth2 credentials. SetEventtoNew Attachment. This node polls your inbox and fires whenever an email arrives that includes at least one attachment. You can optionally set a label filter (e.g.INBOX) in theFilterssection to narrow which emails are monitored. - 2
Filter: Confirm the email actually has an attachment
Add an
IFnode connected to the Gmail Trigger. In the condition, check that{{$json["attachments"].length}}is greater than0. Route thetruebranch forward. This prevents the workflow from erroring on trigger misfires. Thefalsebranch can be left unconnected. - 3
Prepare: Extract and name the attachment data
Add a
Setnode after thetruebranch of the IF node. Create a field calledfileNamewith value{{$json["attachments"][0]["name"]}}and a field calledfileDatawith value{{$json["attachments"][0]["content"]}}. This isolates the first attachment's name and base64 content so the Drive node can consume them cleanly. - 4
Save: Upload the file to Google Drive
Add a
Google Drivenode set to theUploadoperation. Connect it to your Google account via OAuth2 credentials. SetFile Nameto{{$json["fileName"]}}, setBinary PropertyorFile Contentto{{$json["fileData"]}}, and setParentsto the ID of the Drive folder where you want files saved (copy the folder ID from the Drive URL). EnableConvert to Binaryif prompted so n8n handles the base64 correctly.
Frequently asked questions
What if an email has multiple attachments — will all of them be saved?
The basic workflow saves only the first attachment per email. To handle multiple attachments you would add a `Split In Batches` or `Loop` node to iterate over the attachments array. For most freelancers receiving single-file emails (invoices, contracts, briefs) the default setup covers the common case.
How do I find the Google Drive folder ID to paste into the node?
Open the destination folder in Google Drive in your browser. Look at the URL — it will look like `https://drive.google.com/drive/folders/1aBcDeFgHiJkL`. The long string of characters after `/folders/` is the folder ID. Copy and paste that into the `Parents` field of the Google Drive node.
Will this workflow save attachments from emails I already received, or only new ones going forward?
The Gmail Trigger only watches for new incoming emails from the moment the workflow is activated. It does not process emails that arrived before activation. If you need to backfill old attachments, you can temporarily switch to a Gmail node (not trigger) and search by date range, then run it manually once.