n8n

How to Automate Google Drive Folder Organization?

Build the exact folder path you need in Google Drive with one call. The flow creates each folder in order and returns the final folder ID. It is ideal for teams that save files into standard structures from many automations.

It accepts a parent folder ID and a path string like Projects/Clients/Reports. The path is split into parts, then Google Drive is searched for the first folder inside the parent. If the folder does not exist, a new subfolder is created. The loop repeats until every part is created, and the last folder ID is passed forward for uploads.

Use it as a shared subflow that other n8n workflows call. Most teams cut folder setup time from minutes to seconds and avoid duplicate folders. Provide google_drive_folder_id and desired_path, test with the manual trigger, then call it from other flows with the Execute Workflow node to standardize file saves at scale.

What are the key features?

  • Manual Trigger for safe testing with sample inputs
  • Execute Workflow Trigger so other automations can call it and pass data
  • Code nodes split the path string into parts and prepare loop data
  • Google Drive search checks for an existing folder inside the chosen parent
  • Conditional logic creates a new subfolder only when it does not already exist
  • Loop logic shifts through each path part until the whole path is built
  • Returns the final folder ID so downstream nodes can upload files right away
  • Secure OAuth2 connection to Google Drive

What are the benefits?

  • Reduce manual work from 10 minutes to under 30 seconds by creating full paths automatically
  • Eliminate duplicate folder creation by checking for existing folders before creating new ones
  • Standardize Google Drive structures across teams and projects
  • Scale path creation by calling this as a shared subworkflow from many automations
  • Speed up file uploads by returning the final folder ID for immediate use

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Google Drive. See the Tools Required section above for links to create accounts with these services.
  3. Open the Google Drive nodes named Check if top folder exists and Create new subfolder. In the credential dropdown, click Create new credential and follow the on screen steps to connect your Google Drive account with OAuth2.
  4. Confirm both Google Drive nodes use the same credential and point to the correct Drive, such as My Drive or a shared drive your account can access.
  5. In the Dummy input data node, set google_drive_folder_id to root or paste the ID of the parent folder where you want to build paths.
  6. In the same node, set desired_path to a test value like Projects/Clients/Reports.
  7. Click Test workflow to run a manual test. Check Google Drive to confirm each folder in the path now exists under the chosen parent.
  8. Add this flow to your main automation by using an Execute Workflow node. Pass two fields in the payload: google_drive_folder_id and desired_path.
  9. Use the returned google_drive_folder_id from this subflow in your upload or file move nodes so files land in the correct final folder.
  10. If you see permission errors, ensure the connected Google Drive account has access to the parent folder or shared drive. Update the credential or parent folder ID as needed.
  11. If similar folder names cause confusion, make sure each level in the path is unique within its parent. The search checks by name inside the given parent ID.
  12. After validation, disable the Manual Trigger and rely on Execute Workflow calls from your production automations.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Google Drive

Sign up

Drive API: $0 (no additional cost; quota-limited)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.