Tip: Create a dedicated "Inbox" folder in Google Drive specifically for this automation to monitor.
Automatically Classify and Organize PDFs
What You'll Have When Done: Transform your chaotic file storage into an intelligent system that automatically classifies incoming PDFs and files them into the correct folders based on their content - no more manual sorting required.
Prerequisites
Before you begin, make sure you have:
- A PDF.co API Key (Get yours here)
- A Google Drive account with folder structure set up
- Google Drive OAuth2 credentials configured in n8n
- An n8n instance (cloud or self-hosted)
- A designated "incoming" folder in Google Drive for new files
- Pre-created destination folders matching your classification categories
- A Document Classifier rule in CSV format and at least one sample document (Samples here and here)
Quick Start Options
Option A: I Want It Working Now
- Import this workflow template → Download JSON File
- Connect your Google Drive account in n8n
- Add your PDF.co API key
- Set up your folder structure and classification rules
- Configure the watched folder
- Test with sample files
- Activate and let it run
Option B: I Want to Build It Step-by-Step
Follow the 4-step guide below to create the automation from scratch.
What This Automation Does (Overview)
- Monitors a specific Google Drive folder for new PDF files
- Classifies each file using PDF.co's intelligent document classifier
- Searches for the appropriate destination folder based on classification
- Moves the file automatically to the correct organized folder
Step 1: Monitor for New Files
Node: Google Drive Trigger
Settings:
- Trigger On:
Changes Involving a Specific Folder
- Folder from List: Select your "incoming" or "unsorted" folder
- Watch For:
File Created
Success Looks Like: The trigger activates immediately when a new file is added to your watched folder.
Step 2: Classify the Document
Node: HTTP Request (PDF.co Document Classifier)
Settings:
- Method: POST
- URL:
https://api.pdf.co/v1/pdf/classifier
- Headers:
x-api-key
: Your PDF.co API keyContent-Type: application/json
- Body (JSON):
{
"url": "{{ $json.webContentLink }}",
"rulescsv": "Amazon AWS, OR, Amazon Web Services Invoice, Amazon CloudFront\nDigital Ocean, OR,DigitalOcean, DOInvoice\nACME,OR, ACME Inc.,1540 Long Street"
}
Customize Your Classification Rules: The rulescsv
parameter defines how documents are classified. Format: FolderName
, OR
, keyword1
, keyword2
, keyword3
Examples:
Invoices, OR, Invoice, Bill, Payment Due
Contracts, OR, Agreement, Contract, Terms and Conditions
Receipts, OR, Receipt, Purchase, Transaction
Success Looks Like: PDF.co analyzes the document content and returns a classification result with the matched category name. The response includes a classes
array with the best match.
Note: Learn more about the PDF Classifier API in the API Documentation
Step 3: Find the Destination Folder
Node: Google Drive → Search files and folders
Settings:
- Resource: File/Folder
- Operation: Search
- Query String:
={{ $json.body.classes[0].class }}
- Filter:
- Folder ID: Your main organizational folder (parent of all category folders)
Success Looks Like: The search returns the folder that matches the classification result. If "Invoices" was classified, it finds your "Invoices" folder.
Tip: Ensure your folder names exactly match the classification categories you defined in Step 2.
Step 4: Move File to Correct Folder
Congrats! You've built an intelligent file management system that automatically organizes your documents based on their content. Your team can now simply drop files into one folder and watch them get perfectly organized without any manual intervention.
Built something cool? Share it with us @pdfdotco
Related Tutorials



