Automate Bulk File Uploads to Google Drive with n8n

This n8n workflow automates uploading multiple files to a specified Google Drive folder. It checks if the folder exists and creates it if not, saving you hours of manual organization and upload time.
formTrigger
googleDrive
code
+3
Workflow Identifier: 1558
NODES in Use: Form Trigger, Set, Google Drive, If, Code, Sticky Note

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Sarah, a project manager at a busy marketing agency. Every week, she collects dozens of files from various team members—graphics, presentations, and documents—that need to be uploaded neatly into Google Drive folders for each campaign. Until now, Sarah has been manually creating folders, searching for them, and uploading files one by one. This process can take upwards of three hours each week, often leading to mistakes such as misplaced files or duplicated folders, causing delays and lost productivity.

If only there was a way to automate this tedious task to save time, reduce errors, and keep the Drive organized, all without needing advanced programming skills.

2. What This Automation Does

This n8n workflow streamlines Sarah’s weekly bulk file uploads by:

  • Accepting multiple files and a target folder name through a simple form submission.
  • Checking if the specified Google Drive folder already exists inside a preset parent folder.
  • Automatically creating the folder if it doesn’t exist, avoiding duplication and confusion.
  • Uploading all the submitted files into the right folder, preserving the original file names.
  • Handling both the case where the folder exists or is newly created, ensuring seamless operation.
  • Saving Sarah 3+ hours weekly and minimizing upload errors from manual handling.

3. Prerequisites ⚙️

  • n8n cloud or self-hosted account (see self-hosting options)
  • Google Drive account with OAuth credentials configured in n8n 🔑
  • The Form Trigger node setup, which acts as the entry point for file uploads 📁
  • Basic familiarity with n8n interface

4. Step-by-Step Guide

Step 1: Create the Form Trigger to Receive Files

Navigate to + New Workflow in n8n, then add a Form Trigger node.

Set the formTitle to “Batch File Upload to Google Drive”. Add two form fields:

  • A File field named “file” (required)
  • A Text field named “folderName” (required) to specify the target folder

This node provides a webhook URL for the form you will use to submit files and folder names.

Common mistake: Forgetting to mark fields as required can cause incomplete submissions.

Step 2: Extract Folder Name using Set Node

Add a Set node named “Get Folder Name”. Map the incoming JSON field folderName to the node’s output for later use.

Navigate: Click Add NodeSet → Under Assignments, set folderName string value to {{ $json.folderName }}.

You should see the folder name ready for the next search step.

Common mistake: Using incorrect expression syntax here causes failures downstream.

Step 3: Search for Existing Folder in Google Drive

Add a Google Drive node named “Search specific folder”.

Configure it as follows:

  • Resource: File/Folder
  • Search Method: Query
  • Query String: mimeType='application/vnd.google-apps.folder' and name = '{{ $json.folderName }}' and '' in parents
  • Replace with your parent Google Drive folder ID where uploads should reside.
  • Select your Google Drive OAuth credentials.

This query checks if the folder already exists to avoid duplicates.

Common mistake: Not replacing with your actual Drive folder ID.

Step 4: Add an If Node to Check Folder Existence

Add an If node named “Folder found ?”. Use the condition to check if the search result is empty or not:

  • Condition: ={{ $json }} is not empty

True branch: Folder exists; use this folder for upload.

False branch: Folder does not exist; create it next.

Common mistake: Misconfiguring the condition leads to incorrect branching.

Step 5: Create a Google Drive Folder if It Doesn’t Exist

Add a Google Drive node named “Create Folder” on the False branch.

Configure:

  • Resource: Folder
  • Name: {{ $('On form submission').item.json.folderName }}
  • Drive ID: Usually “My Drive”
  • Parent Folder ID: Your chosen parent folder (same as in step 3)
  • Use Google Drive OAuth credentials

This node auto-creates the folder if missing.

Common mistake: Not specifying the parent folder ID means folder gets created at root.

Step 6: Prepare Files for Upload (Both Branches)

On both True and False branches, add Code nodes named “Prepare Files for Upload” (existing folder) and “Prepare Files for New Folder” (new folder).

Paste this JavaScript to split binary files individually:

let results = [];
const items = $("On form submission").all()

for (item of items) {
    for (key of Object.keys(item.binary)) {
        results.push({
            json: {
                fileName: item.binary[key].fileName
            },
            binary: {
                data: item.binary[key],
            }
        });
    }
}

return results;

This ensures each file uploads separately with its original file name.

Common mistake: Forgetting to update references to the form submission node if renamed.

Step 7: Upload Files to the Appropriate Google Drive Folder

Add two Google Drive nodes:

  • “Upload Files” connected to the existing folder branch, Folder ID from search result.
  • “Upload to New Folder” connected to the newly created folder branch, Folder ID from “Create Folder” node.

Configure both nodes to upload the file binary from the “data” field and use the file name from JSON for naming.

Common mistake: Not setting the correct input data field name results in empty file uploads.

5. Customizations ✏️

  • Change the parent folder ID in the “Search specific folder” and “Create Folder” nodes to upload files into different Google Drive directories.
  • Modify the form fields to accept other metadata like description or tags and extend the workflow to handle these additional details.
  • Add email notification nodes to alert users after upload completion with links to the uploaded folder.
  • Integrate file type validation in the Code node to restrict uploads to certain file formats.

6. Troubleshooting 🔧

Problem: “No folder found and creation fails”

Cause: Incorrect Google Drive parent folder ID or missing Drive permissions.

Solution: Double-check the parent folder ID in the Google Drive nodes and verify OAuth credentials have correct scopes.

Problem: “Uploaded files are empty or corrupted”

Cause: Input binary data not properly passed to Google Drive upload nodes.

Solution: Ensure the Code node outputs binary data under the field name “data” and Google Drive node input is set to “data”.

7. Pre-Production Checklist ✅

  • Verify Google Drive OAuth credentials are active and have correct scopes.
  • Test the form trigger by submitting sample multiple files and a folder name.
  • Confirm the folder search query returns correct results.
  • Ensure the If node correctly branches based on folder existence.
  • Test both paths for uploading to existing and newly created folders.

8. Deployment Guide

Activate your workflow in n8n once tested successfully.

Use the webhook URL from the Form Trigger to integrate with your frontend or sharing it with users.

Monitor recent workflow runs in n8n to catch any errors or failed uploads promptly.

9. FAQs

Q: Can I customize the parent folder where files are uploaded?
A: Yes, just update the parent folder ID in the Google Drive nodes accordingly.

Q: Does this workflow consume Google Drive API quota?
A: Yes, each folder search, creation, and file upload uses API calls. Monitor your quota if uploading large volumes.

Q: Is data uploaded securely?
A: Yes, Google Drive OAuth ensures secure access. Files upload directly to your Drive linked with your account.

10. Conclusion

By following this tutorial, you have automated the bulk uploading of files to Google Drive based on folder availability, reducing Sarah’s tedious manual work by over 3 hours weekly.

This workflow ensures organization and accuracy, avoiding duplicate folders and misplaced files entirely.

Next, consider automating file renaming, adding Google Drive sharing permissions automatically, or sending summary email reports after uploads to further boost productivity.

Happy automating your Google Drive file management with n8n!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free