Skip to main content

Organize email attachments into Google Drive folders by company with Gmail & Sheets

Workflow preview

Workflow preview
100%
Organize email attachments into Google Drive folders by company with Gmail & Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Automated Email Attachment Organizer Automatically process labeled emails with attachments into organized Google Drive folders Who Is This For? Teams or Individuals needing to: Automatically sort i...

Best for

  • File Management automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googledrive, n8n-nodes-base.if, n8n-nodes-base.gmailtrigger, n8n-nodes-base.gmail, n8n-nodes-base.function, n8n-nodes-base.stickynote, n8n-nodes-base.set, n8n-nodes-base.splitinbatches

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Ventsislav Minev.

Original n8n.io source

1.1 Workflow description

Title
Organize email attachments into Google Drive folders by company with Gmail & Sheets
Workflow name
Organize email attachments into Google Drive folders by company with Gmail & Sheets

Automated Email Attachment Organizer

Automatically process labeled emails with attachments into organized Google Drive folders


Who Is This For?

  • Teams or Individuals needing to:
    • Automatically sort invoices, receipts, and files.
    • Organize client documents by date.
    • Verify sender emails against a whitelist.
    • Timestamp files to avoid duplicate names.

What Does This Workflow Solve?

  • πŸ•’ Manual Email Sorting: Saves time by automating the organization of email attachments.
  • πŸ“‚ Disorganized Cloud Storage: Ensures attachments are neatly stored in Google Drive folders.
  • πŸ“§ Unverified Sender Issues: Filters and validates emails using a whitelist.
  • πŸ”„ Duplicate Filenames: Uses timestamps to ensure every file name is unique.

Setup Guide

1. Pre-Requisites

  • Whitelist Sheet: Make a copy of the Example Whitelist Sheet
  • Gmail Filter: Create a filter in Gmail to label emails with attachments.

To Create a Gmail Filter:

  1. Open your Gmail Inbox.
  2. Click the search bar and select "Show search options".
  3. Enter your criteria (e.g., type has:attachment).
  4. Click "Create filter".
  5. Choose "Apply the label: Custom_Label" and save.

2. Credentials Setup

Make sure your n8n instance is connected with:

  • Gmail Account: (via OAuth2)
  • Google Drive Account: (via OAuth2)
  • Google Sheets (via OAuth2)

3. Configure Your n8n Workflow Nodes

1. Trigger and Email Retrieval
  • Gmail Trigger: Setup check interval and filters for emails (i.e. emails labeled with Custom_Label)
2. Whitelist settings
  • Lookup in Sheets: Searches for a row with the sender email. Configure this node to point to your whitelist spreadsheet containing two columnds: |email|company|
3. File storage location
  • Confirue parent folder to create sub-folders and store files into in the Create Company Folder node Parent Folder dropdown

Final Steps

  1. Test Your Workflow: Run the workflow to verify emails are processed and files are uploaded correctly.

Happy Automating!

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Search For Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 2 - Create Month Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 3 - Check If Folder Exists

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 4 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 5 - Gmail

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - Split Up Binary Data1

Type / Role
n8n-nodes-base.function - function
Config choices
Version 1

Block 7 - Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - YYYY/MM

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 10 - Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Company Folder Exists

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 12 - Create Company Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 13 - Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Lookup in Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 16 - Search Company Folder1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 17 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Upload To Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

3. Summary Table

Workflow Organize email attachments into Google Drive folders by company with Gmail & Sheets
Complexity advanced
Nodes 19
Categories File Management
Author Ventsislav Minev
Published 07 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3464/3464.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Organize email attachments into Google Drive folders by company with Gmail & Sheets do?

Automated Email Attachment Organizer Automatically process labeled emails with attachments into organized Google Drive folders Who Is This For? Teams or Individuals needing to: Automatically sort i...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your File Management use case.