← All N8N workflows
Data & databasesFunctionGmailGmail TriggerGoogle DriveGoogle Sheets

Upload attachments to Drive

Configured with Function, Gmail, Gmail Trigger, Google Drive, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
Files / mediaSearch For FolderGoogle DriveFiles / mediaCreate Month FolderGoogle DriveRoutingCheck If Folder ExistsIfTriggerGmail TriggerGmail TriggerMessagingGmailGmailCodeSplit Up Binary Data1FunctionTransformYYYY/MMEdit FieldsRoutingLoop Over ItemsLoop Over ItemsRoutingCompany Folder ExistsIfFiles / mediaCreate Company FolderGoogle DriveData storeLookup in SheetsGoogle SheetsFiles / mediaSearch Company Folder1Google DriveFiles / mediaUpload To FolderGoogle Drive

Node categories in this workflow

  • Files / media
  • Routing
  • Trigger
  • Messaging
  • Code
  • Transform
  • Data store

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Search For FolderFiles / mediaGoogle DrivefileFolder
Create Month FolderFiles / mediaGoogle Drivefolder
Check If Folder ExistsRoutingIfSee node parameters
Gmail TriggerTriggerGmail TriggerSee node parameters
GmailMessagingGmailget
Split Up Binary Data1CodeFunctionSee node parameters
YYYY/MMTransformEdit FieldsSee node parameters
Loop Over ItemsRoutingLoop Over ItemsSee node parameters
Company Folder ExistsRoutingIfSee node parameters
Create Company FolderFiles / mediaGoogle Drivefolder
Lookup in SheetsData storeGoogle SheetsSee node parameters
Search Company Folder1Files / mediaGoogle DrivefileFolder
Upload To FolderFiles / mediaGoogle DriveSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • gmailOAuth2
  • googleDriveOAuth2Api
  • googleSheetsOAuth2Api

Workflow notes

Upload attachments to Drive

Upload attachments to Drive

Incoming files are split up into individual items, each with a single binary data object under the data key. Files names are prefixed with the current timestamp

2. Google Sheets Whitelist Config

2. Google Sheets Whitelist Config

To filter contacts against a whitelist:

1. Make a copy of this spreadsheet

OR create a Google Sheet with two columns: | email | company |

2. Add whitelisted emails and their company as rows in the sheet and configure this node Document and Sheet to point to it.

1. Trigger Settings and Filters

1. Trigger Settings and Filters

Configure the interval to check for new emails and apply filters to process only some emails

For example: To create a filter that applies a label to emails with attachments containing the words "invoice" or "receipt," follow these steps:

  1. Open your Gmail and click on the burger menu button next to the search bar to open the search options.
  2. In the Has the words field type in 'invoice receipt'
  3. Check the Has attachment checkbox
  4. Click on the "Create filter with this search" option at the bottom of the search window.
  5. In the filter options, select the "Apply the label" option and choose or create a label for these emails.
  6. Click "Create filter" to save your new filter.
Upload attachments to Drive

Upload attachments to Drive

Purpose and structure

This folder contains the Upload attachments to Drive workflow. Its executable nodes use function, gmail, gmailTrigger, googleDrive, googleSheets, if, set, splitInBatches. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Gmail Trigger

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Googlesheets/0837_GoogleSheets_Gmail_Create_Triggered.json MIT; preserve source notices.

Canvas section labels

These name areas of the original canvas; they do not include explanatory instructions.

  • Checks if YYYY/MM Folder exists
  • Checks if a folder with the company of the email exists
  • 3. Configure storage location

More in Data & databases