Gmail attachment backup to Google Drive
π₯ Gmail Attachment Backup to Google Drive β n8n Workflow This n8n workflow automatically backs up email attachments from a specific sender in Gmail to a des...
π Nodes & Integrations Used (3)
π Implementation & Setup Guide
π₯ Gmail Attachment Backup to Google Drive β n8n Workflow
This n8n workflow automatically backs up email attachments from a specific sender in Gmail to a designated folder in Google Drive. It polls Gmail every minute and uploads any new attachments from matching emails to the specified Google Drive folder with a timestamped filename.
---
π Use Case
**Primary Purpose**: - Automatically archive and back up attachments from a specific sender (e.g., `test@gmail.com`) to Google Drive for safekeeping, audit, or processing.
**Ideal For**: - Automating invoice/receipt collection from a vendor - Archiving reports from a monitored email address - Creating a searchable historical log of attachments for compliance
---
π§ Workflow Overview
Hereβs how the workflow operates:
- **π Gmail Trigger**
- Polls Gmail every minute for new messages from a specific sender (`test@gmail.com`).
2. **π© Gmail Get Message** Retrieves the full contents (including attachments) of the matched email.
3. **π§ Code (JS)** Iterates over all binary attachments in the email and restructures them as individual binary items to upload separately.
4. **π€ Google Drive** Uploads each attachment to a target Google Drive folder (`DOcs`) with a timestamp and unique name.
5. **π Replace Me (NoOp)** Placeholder node to indicate workflow completion. You can replace this with Slack notifications, logs, or alerts.
---
π§ How to Use
Prerequisites
- An [n8n](https://n8n.io/) instance (self-hosted or cloud)
- A connected Gmail account with OAuth2 credentials
- A connected Google Drive account with OAuth2 credentials
- Permissions for n8n to access your Gmail and Google Drive
Setup Instructions
- **Import the Workflow**
- Copy and paste the workflow JSON into your n8n editor.
2. **Set Up Credentials** Ensure the following credentials exist and are authorized: - `Gmail (for Gmail nodes) - `Google Drive (for Google Drive node)
3. **Configure the Folder** Update the `folderId` in the Google Drive node if you want to use a different target folder.
4. **Activate the Workflow** Enable the workflow in n8n. It will start polling Gmail every minute.
---
βοΈ How to Customize
| Task | How to Customize | |------|------------------| | Change sender filter | Modify the `sender` field in the **Gmail Trigger** node | | Adjust polling frequency | Change the `pollTimes` configuration in the trigger node | | Change destination folder | Update `folderId` in the **Google Drive** node | | Modify filename format | Edit the `name` expression in the **Google Drive** node | | Add post-upload logic | Replace or extend the **Replace Me** node with notifications, logs, etc. | | Process only specific attachments | Add logic in the **Code** node to filter by filename or MIME type |
---
π Filename Format Example
``` [MessageID]_[Timestamp]_backup_attachment ```
This naming convention ensures uniqueness and traceability back to the original message.
---
β Future Improvements
- **Email subject filtering** to narrow down the match
- **Slack/Email notifications** after upload
- **Deduplication check** to avoid reuploading the same files
- **Virus scan or file validation** before upload
---
π¬ Support
For any issues using this workflow: - Double-check your credential permissions - Review n8n logs for Gmail or Google Drive errors - Visit the [n8n community forums](https://community.n8n.io)
β‘ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Gmail attachment backup to Google Drive.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related Email & Outreach Workflows
View All in Email & Outreach βAbandoned cart recovery for Shopify via Gmail Google Sheets T
Who is this for? This template is ideal for solo store owners, eCommerce marketers, automation beginners, or anyone using Shopify and Gmail who wants to reco...
Add new leads in Lemlist from Airtable
This workflow allows you to add new leads in Lemlist from Airtable. !workflow-screenshot Airtable node: This node lists all the emails that are stored in you...
Add Subscriber and Send Email Campaign
Production-ready n8n automation template for Add Subscriber and Send Email Campaign built by AhiXLight. Seamlessly connects Sendy with 3 configured nodes.
Add new contacts from HubSpot to the email list in Mailchimp
This workflow adds new HubSpot contacts to the Mailchimp email list. Prerequisites - HubSpot account and HubSpot credentials - Mailchimp account and Mailchim...