Skip to main content

Classify and route uploaded documents to Google Drive with an AI agent

Workflow preview

Workflow preview
100%
Classify and route uploaded documents to Google Drive with an AI agent preview
Open on n8n.io

1. Workflow Overview

What This Workflow Does Upload a document (PDF, PNG, JPEG) via a web form and let an AI agent classify it and route it to the correct Google Drive folder on its own. No rule based routing, no Switc...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.slacktool, n8n-nodes-base.googledrivetool, n8n-nodes-base.formtrigger, n8n-nodes-base.googledrive, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatgooglegemini, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Felix.

Original n8n.io source

1.1 Workflow description

Title
Classify and route uploaded documents to Google Drive with an AI agent
Workflow name
Classify and route uploaded documents to Google Drive with an AI agent

What This Workflow Does

Upload a document (PDF, PNG, JPEG) via a web form and let an AI agent classify it and route it to the correct Google Drive folder on its own. No rule-based routing, no Switch nodes – the agent decides the category and calls the matching move tool. Documents it can't confidently classify are moved to a Needs Review folder and flagged via Slack.

How It Works

  1. User uploads a file through the hosted web form
  2. The file is uploaded to a temporary Incoming folder in Google Drive
  3. The file ID and name are passed to the AI Agent
  4. The agent classifies the document and calls the matching Move tool (e.g. move_to_medical)
  5. If it can't confidently classify, it calls Move to Needs Review + sends a Slack alert

Supported categories: medical_invoice · restaurant_invoice · hotel_invoice · trades_invoice · telecom_invoice


Setup Guide

1. Create Your Google Drive Folders

Create one folder per category in Google Drive:

  • Incoming (temporary landing folder)
  • Medical · Restaurant · Hotel · Trades · Telecom
  • Needs Review

2. Connect Google Drive

  1. In n8n, go to Settings → Credentials and create a Google Drive OAuth2 credential
  2. This requires a Client ID and Client Secret from Google Cloud Console (APIs & Services → Credentials → OAuth 2.0 Client ID)
  3. Make sure the Google Drive API is enabled in your Google Cloud project
  4. Open the Upload to Incoming Folder node and select your Incoming folder
  5. Open each of the 6 Move tool nodes and select the correct target folder

3. Connect Your Chat Model

  1. Add a credential for your chosen model (Gemini, OpenAI, Anthropic) in Settings → Credentials
  2. Open the Chat Model node and assign the credential
  3. Any tool-calling capable model will work – Gemini 1.5 Pro or GPT-4o recommended

4. Connect Slack

  1. Create a Slack API credential in n8n (needs a Bot Token with chat:write scope)
  2. Create a channel for review notifications (e.g. #document-review)
  3. Invite the bot to that channel
  4. Open the Slack: Notify Review Channel node and select the correct channel

5. Activate & Test

  1. Click Active in the top-right corner of n8n
  2. Open the form URL and upload a test document
  3. Check the execution log to confirm the classification and the move action
  4. Verify the file lands in the correct Google Drive folder
  5. Test with an unrecognizable document to confirm the Slack alert fires

Notes

  • The agent's classification quality depends on the filename and the chat model's reasoning. Descriptive filenames improve accuracy significantly.
  • This workflow is an agentic demo – it replaces deterministic routing with LLM decision-making. For production-grade document classification with structured extraction, per-field prompting, and explicit confidence scoring, check out the easybits Extractor community node.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - send_review_alert

Type / Role
n8n-nodes-base.slackTool - slackTool
Config choices
Version 2.4

Block 2 - move_to_medical

Type / Role
n8n-nodes-base.googleDriveTool - googleDriveTool
Config choices
Version 3

Block 3 - move_to_restaurant

Type / Role
n8n-nodes-base.googleDriveTool - googleDriveTool
Config choices
Version 3

Block 4 - move_to_hotel

Type / Role
n8n-nodes-base.googleDriveTool - googleDriveTool
Config choices
Version 3

Block 5 - move_to_trades

Type / Role
n8n-nodes-base.googleDriveTool - googleDriveTool
Config choices
Version 3

Block 6 - move_to_telecom

Type / Role
n8n-nodes-base.googleDriveTool - googleDriveTool
Config choices
Version 3

Block 7 - move_to_review

Type / Role
n8n-nodes-base.googleDriveTool - googleDriveTool
Config choices
Version 3

Block 8 - Document Upload

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.5

Block 9 - Upload to Incoming Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 10 - AI Agent: Classify & Route

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 11 - Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Classify and route uploaded documents to Google Drive with an AI agent
Complexity advanced
Nodes 18
Categories Invoice Processing, AI Summarization
Author Felix
Published 28 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15365/15365.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Classify and route uploaded documents to Google Drive with an AI agent do?

What This Workflow Does Upload a document (PDF, PNG, JPEG) via a web form and let an AI agent classify it and route it to the correct Google Drive folder on its own. No rule based routing, no Switc...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.