🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Google Drive sorting that keeps uploads organized

Lisa Granqvist Partner Workflow Automation Expert

Your “Uploads” folder starts clean, then turns into a junk drawer. PDFs, screenshots, random JSON exports, scanned forms. Someone needs a file fast, and suddenly you’re searching, guessing, and opening the wrong version three times.

This Drive sorting automation hits office admins first, honestly. But marketing coordinators and ops leads feel it too when a shared Drive becomes untrustworthy. The outcome is simple: every new file gets routed into the right folder (Docs, PDFs, Images) so people can find things in seconds, not minutes.

Below, you’ll see how the workflow behaves, what it fixes in day-to-day work, and what you need to run it in n8n without turning this into an IT project.

How This Automation Works

See how this solves the problem:

n8n Workflow Template: Google Drive sorting that keeps uploads organized

The Challenge: Upload folders become a mess

Google Drive is great until it becomes the place where everything lands and nothing lives where it should. A teammate uploads a contract PDF “real quick” and leaves it in the root. Another person drags in a batch of photos from their phone. Someone exports a JSON file from a tool and tosses it in the same folder because, well, where else would it go? The problem isn’t one messy upload. It’s the slow drip of tiny interruptions: searching, re-sorting, second-guessing, and pinging coworkers for links you already have somewhere.

The friction compounds. Here’s where it breaks down in real teams.

  • You waste time hunting through mixed file types when all you needed was “the PDF version.”
  • People misfile uploads because they’re rushing, which means your folder structure stops meaning anything.
  • Duplicates pile up because nobody is confident which file is “the right one.”
  • New hires learn the hard way that searching Drive is a daily chore, not a backup plan.

The Fix: Automatic Google Drive file sorting by type

This n8n workflow watches a specific Drive folder you choose (think “Uploads” or “Incoming”). When you run it, it pulls the list of files in that folder, then processes them one-by-one so nothing gets skipped. For each file, it reads the metadata (including MIME type), decides what the file is, and moves it into the matching destination folder. PDFs go to your PDFs folder, JPEG images go to Images, and JSON (and other “document-like” types you define) go to Documents. When it’s done, the source folder is clean again, and your team’s structure stays intact without someone playing librarian every afternoon.

The workflow starts with a manual run in n8n, which is useful when you’re cleaning up a batch of uploads. Then it loops through each file, checks the type with simple if/then logic, and moves the file to its correct folder in Google Drive. Finally, it returns to the loop and keeps going until there’s nothing left to sort.

What Changes: Before vs. After

Real-World Impact

Say your team drops about 40 files a week into an “Uploads” folder. Manually sorting is usually a quick glance, a click, and a move, but it still takes maybe 1 minute per file once you’re interrupted and context-switching, so you’re spending about 40 minutes weekly just filing. Add the “where did it go?” searches (even 10 searches at 3 minutes each), and you’re near 1.5 to 2 hours. With this workflow, you run it once, let it iterate through the batch, and the folder is clean again while you do something else.

Requirements

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Google Drive for listing, inspecting, and moving files.
  • Google Drive OAuth2 access to authorize your Drive connection.
  • Destination folders (Documents, PDFs, Images) created in Drive.

Skill level: Beginner. You’ll connect Google Drive, select folder IDs, and optionally tweak which MIME types count as “Documents.”

Need help implementing this? Talk to an automation expert (free 15-minute consultation).

The Workflow Flow

You run it manually in n8n. That’s intentional, because this workflow is perfect for cleaning up a pile of files after a busy day (or after a client dumps a whole batch on you).

Google Drive pulls the file list from your chosen source folder. The workflow retrieves every item inside that folder so it can process the whole backlog, not just one file.

Each file is handled individually. n8n loops through the list in batches, downloads metadata for the file (including MIME type), then routes it through simple “if” checks to classify it as a Document, PDF, or Image.

Files get moved into the matching destination folder. Google Drive does the final move, then the workflow returns to the loop to pick up the next file until everything is sorted.

You can easily modify which file types count as “Documents” or add extra categories (like PNGs, DOCX, or spreadsheets) based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Manual Trigger

This workflow starts manually, making it ideal for testing your file relocation logic before scheduling it.

  1. Add the Manual Execution Start node as the trigger.
  2. Leave all fields at their defaults since no configuration is required.
  3. Connect Manual Execution Start to Retrieve Drive Items to begin the workflow chain.

Step 2: Connect Google Drive

These nodes handle listing, downloading, and moving files in Google Drive. Connect your Google Drive credentials once and reuse them across all Drive nodes.

  1. Open Retrieve Drive Items and set Resource to fileFolder.
  2. Set Return All to true and choose the folder in Filter → Folder ID (replace [YOUR_ID] with your Drive folder).
  3. Credential Required: Connect your googleDriveOAuth2Api credentials to Retrieve Drive Items, Fetch File Content, Relocate Documents, Relocate PDFs, and Relocate Images.

⚠️ Common Pitfall: The workflow uses placeholder folder IDs ([YOUR_ID]) in multiple nodes—replace them with real folder IDs or moves will fail.

Step 3: Set Up File Retrieval and Batching

This stage loops through files, downloads each file, and sends it into the type checks. The workflow uses a batch loop for controlled processing.

  1. Add Batch Iterator after Retrieve Drive Items to process files iteratively.
  2. Connect the second output of Batch Iterator to Fetch File Content to process each file one at a time.
  3. In Fetch File Content, set Operation to download.
  4. Set File ID to ={{$json['id']}} so it downloads the current file from the batch.

Step 4: Set Up File Type Routing Logic

The workflow checks MIME types to route documents, PDFs, and images to different destination folders. The flow is sequential: Document Type CheckPDF Type CheckImage Type Check.

  1. In Document Type Check, set the condition to compare Left Value ={{$binary.data.mimeType}} with Right Value application/json.
  2. Connect the true path of Document Type Check to Relocate Documents, and the false path to PDF Type Check.
  3. In PDF Type Check, compare ={{$binary.data.mimeType}} to application/pdf, then connect the true path to Relocate PDFs and the false path to Image Type Check.
  4. In Image Type Check, compare ={{$binary.data.mimeType}} to image/jpeg with case-insensitive matching enabled.

Tip: Expand the MIME checks if you want to support additional document or image types (e.g., image/png or application/vnd.openxmlformats-officedocument.wordprocessingml.document).

Step 5: Configure File Relocation Actions

Each file type is moved to a specific folder and then loops back to the batch node for the next file.

  1. In Relocate Documents, set Operation to move, File ID to ={{ $json['id'] }}, Drive ID to My Drive, and Folder ID to your documents folder (e.g., json_check).
  2. In Relocate PDFs, set Operation to move, File ID to ={{ $json['id'] }}, Drive ID to My Drive, and Folder ID to your PDF folder (e.g., pdf_check).
  3. In Relocate Images, set Operation to move, File ID to ={{ $json['id'] }}, Drive ID to My Drive, and Folder ID to your images folder (e.g., images_check).
  4. Connect Relocate Documents, Relocate PDFs, and Relocate Images back to Batch Iterator so the loop continues.

Step 6: Test and Activate Your Workflow

Run a manual test to verify file routing, then activate the workflow when ready for production.

  1. Click Execute Workflow to run Manual Execution Start and process the current folder contents.
  2. Confirm that JSON files move to the documents folder, PDFs move to the PDF folder, and JPEGs move to the image folder.
  3. If results look correct, switch the workflow to Active to enable ongoing use.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Watch Out For

  • Google Drive credentials can expire or need specific permissions. If things break, check the n8n Google Drive credential and re-authenticate first.
  • If you’re using loop/batch behavior on a very large folder, processing times vary. Let it run, and if you see timeouts, reduce batch size or run it more frequently on smaller piles.
  • MIME types are picky, and some apps upload “odd” formats. If a file doesn’t get routed, inspect its MIME type in the workflow run data and add a new condition early so you’re not cleaning up strays forever.

Common Questions

How quickly can I implement this Drive sorting automation?

Usually under an hour if your Drive folders are already set up.

Can non-technical teams implement this file sorting automation?

Yes. There’s no coding, but you will need to connect Google Drive and select the source and destination folders.

Is n8n free to use for this Drive sorting automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Google Drive access (typically no extra API cost for normal usage).

Where can I host n8n to run this Drive sorting automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

How do I adapt this Drive sorting automation solution to my specific challenges?

You can add more file types by duplicating the existing “type check” logic and pointing the move action at a new folder. Common tweaks include routing PNGs separately from JPEGs, sending DOCX and Google Docs to a “Contracts” folder, and adding a “Catch-all” folder for anything that doesn’t match.

Why is my Google Drive connection failing in this workflow?

Usually it’s expired or revoked OAuth access in your n8n Google Drive credentials. Reconnect the account, then rerun the workflow on a small batch to confirm it can list and move files. If it still fails, it can be missing permissions on a shared drive folder, or the source/destination folder IDs were copied incorrectly.

What’s the capacity of this Drive sorting automation solution?

On self-hosted n8n there’s no execution cap, and the practical limit is your server and Drive API behavior. On n8n Cloud, capacity depends on your plan’s monthly executions, but this workflow is lightweight because it’s mostly file listing and moves. In practice, sorting a few hundred files in a run is normal as long as you keep batching enabled. If you’re processing thousands daily, schedule more frequent runs so the upload folder never becomes a huge backlog.

Is this Drive sorting automation better than using Zapier or Make?

Often, yes. n8n makes it easier to loop through many files, branch on conditions, and keep the workflow stable without paying extra for every path. You can also self-host, which is a big deal if you want unlimited runs and tighter control over data. Zapier and Make can still work for simple “if file type then move” cases, but they get awkward when you need reliable batching and cleanup. If you’re on the fence, Talk to an automation expert and describe your upload volume and folder structure.

Once this is in place, your upload folder stops being a dumping ground and starts acting like an intake tray. The workflow takes care of the filing so your team can get on with real work.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal