Categorize Google Drive files with OpenAI and log results in Google Sheets
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (15)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - If
n8n-nodes-base.if - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Google Drive
n8n-nodes-base.googleDrive - Switch
n8n-nodes-base.switch - Extract from File
n8n-nodes-base.extractFromFile - Compression
n8n-nodes-base.compression - No Operation, do nothing
n8n-nodes-base.noOp - Slack
n8n-nodes-base.slack - Send Email
n8n-nodes-base.emailSend - Error Trigger
n8n-nodes-base.errorTrigger
What it does
Quick overview This workflow polls a Google Drive “Incoming” folder, uses an OpenAI-compatible Chat Completions API to classify files into predefined categories, moves them into matching subfolders under an “Organized” root, and appends an audit log row to Google Sheets with optional Slack/email notifications. How it works 1. Runs on a schedule (every few minutes) and loads configuration values, then reads a Google Sheets log to determine which files are new or need retrying. 2. Lists non-folder files in the configured Google Drive source folder, filters out already-processed items, and processes a capped batch one file at a time. 3. Detects each file’s type and, when enabled, downloads and extracts content from PDFs, Office files, spreadsheets, text files, or prepares images for vision; otherwise it falls back to filename and metadata only. 4. Sends file metadata and extracted text or image content to an OpenAI-compatible /chat/completions endpoint and parses/repairs the model’s JSON classification response. 5. Validates the category against the approved taxonomy and routes low-confidence, sensitive, or failed classifications to the default “Uncategorized” bucket for review. 6. Finds or creates the destination category folder in Google Drive, applies the configured duplicate-name strategy (keep, rename, or skip), and moves the file while preserving its ID and sharing. 7. Appends a per-file result row (SUCCESS, REVIEW, SKIPPED, or ERROR) to Google Sheets and optionally sends Slack/email notifications for review items, plus an optional daily summary. Setup 1. Add Google Drive OAuth2 credentials (used by both Google Drive nodes and Drive REST calls via HTTP Request) and set the SOURCEFOLDERID and DESTINATIONROOTFOLDERID in the configuration. 2. Add Google Sheets OAuth2 credentials and set the LOGSPREADSHEETID and LOGSHEETNAME to a sheet tab whose header matches the workflow’s log fields. 3. Add an HTTP Header Auth credential for your OpenAI-compatible API (Authorization: Bearer <APIKEY) and confirm the AIBASEURL and AIMODEL values. 4. Review and adjust CATEGORYTAXONOMY, CONFIDENCETHRESHOLD, SENSITIVECATEGORIES, DUPLICATESTRATEGY, and processing limits (MAXFILESPERRUN, MINFILEAGESECONDS, MAXATTEMPTS) in the configuration. 5. (Optional) Enable the Slack and/or SMTP email nodes, add the required credentials, and set SLACKCHANNEL and notification email addresses in the configuration.