← All N8N workflows
Automation & utilitiesCodeExecute Workflow TriggerGoogle DriveIfManual Trigger

Create Google Drive Folders by Path

Configured with Execute Workflow Trigger, Google Drive. Review the connections and setup before adapting this template.

Workflow preview
TriggerWhen clicking ‘Testworkflow’Manual TriggerCodeSet parameters for nextrunCodeTriggerExecute WorkflowTriggerExecute Workflow TriggerTransformDummy input dataEdit FieldsCodeSplit the desired pathCodeCodeCreate desired pathCodeFiles / mediaCheck if top folderexistsGoogle DriveRoutingIf top folder doesn'texistIfFiles / mediaCreate new subfolderGoogle DriveRoutingIf path has beencompletely createdIfTransformReturn the ID of thelast folderEdit Fields

Node categories in this workflow

  • Trigger
  • Code
  • Transform
  • Files / media
  • Routing

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
When clicking ‘Test workflow’TriggerManual TriggerSee node parameters
Set parameters for next runCodeCodeSee node parameters
Execute Workflow TriggerTriggerExecute Workflow TriggerSee node parameters
Dummy input dataTransformEdit FieldsSee node parameters
Split the desired pathCodeCodeSee node parameters
Create desired pathCodeCodeSee node parameters
Check if top folder existsFiles / mediaGoogle DrivefileFolder
If top folder doesn't existRoutingIfSee node parameters
Create new subfolderFiles / mediaGoogle Drivefolder
If path has been completely createdRoutingIfSee node parameters
Return the ID of the last folderTransformEdit FieldsSee 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

  • googleDriveOAuth2Api

Workflow notes

Create Google Drive Folders by Path

Create Google Drive Folders by Path

This workflow created nested Google Drive folder from a path string and returns the ID of the final folder for immediate use.

Use this workflow in your other flows by calling it directly with the following data:

  • google_drive_folder_id -> The ID of the folder where you want to create additional folders in. You can use "root" if you want to begin at root level of your Drive.
  • desired_path -> The folder structure you'd like to create in Google Drive. Each folder is separated by a slash, eg: Projects/Clients/Reports
Test data for the workflow

Test data for the workflow

Use this in case you want to test the workflow.

Triggered from another workflow

Triggered from another workflow

This workflow is intended to be triggered by other workflows. Don't copy/paste this workflow as it will be more difficult to maintain and keep up-to-date.

Main loop

Main loop

Take the desired_path and split it into parts. Eg: Projects/Clients/Reports will turn into 3 parts: Projects, Clients, Reports. We then check if the top folder exists and create it if not. We repeat this process until all subfolders have been created and correctly nested.

Rerturn data

Rerturn data

Here we return the ID of the last folder in the path, so you can start uploading new files to it.

Create Google Drive Folders by Path

Create Google Drive Folders by Path

Purpose and structure

This folder contains the Create Google Drive Folders by Path workflow. Its executable nodes use code, executeWorkflowTrigger, googleDrive, if, manualTrigger, set. 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

When clicking ‘Test workflow’, Execute Workflow 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/Code/0891_Code_Manual_Create_Triggered.json MIT; preserve source notices.

More in Automation & utilities