Use this powerful n8n workflow to automatically categorize and label incoming Gmail threads using AI, based on custom definitions stored in a Google Sheet. Explore n8n templates for AI email processing.
Download this n8n workflow template and start using it instantly.
Business Owners: Who need systematic organization of large volumes of inbound emails (e.g., support, sales leads, press inquiries).
Technical Users and Developers: Seeking practical n8n templates demonstrating advanced AI integration (Langchain/OpenRouter) with core services like Gmail and Google Sheets.
Automation Specialists: Looking for a reusable n8n node sequence to implement robust, scheduled email sorting routines.
Teams: That define their email organization rules externally (in Google Sheets) and require automated enforcement.
Managing high volumes of incoming emails can quickly become overwhelming, leading to missed priorities and manual administrative work. This n8n workflow solves this by creating a hands-off categorization system. It periodically checks for new, uncategorized emails in Gmail and uses a powerful AI agent (via OpenRouter) to determine the correct category based on definitions you provide in a Google Sheet.
This setup allows for dynamic rule changes—just update your Google Sheet definitions, and the n8n automation adapts immediately. By leveraging a scheduled n8n trigger, this entire process runs efficiently in the background, ensuring your inbox remains organized and fully labeled without manual intervention. This advanced use of the n8n node system greatly improves efficiency in email management.
This automation runs on a scheduled n8n trigger, configured to execute every hour.
limit) to process in a single run.has:nouserlabels (are uncategorized), applying the optional extra_filter.onError setting ensures the flow continues without disruption.To deploy this comprehensive n8n workflow, follow these steps:
sheetsurl with the URL of your new category definitions sheet. Adjust the limit or extrafilter as needed. Schedule Trigger (n8n trigger): Sets the execution cadence for the n8n workflow, configured here to run every hour.
Config (Set n8n node): Acts as a central configuration hub. Key parameters include sheets_url (Source of truth for categories) and limit (Controls API usage by restricting the number of emails processed per run).
Get Labels (Google Sheets n8n node): Reads structured data (Name and Definition) from the configured spreadsheet, providing the AI agent with the context needed for categorization.
Get Messages (Gmail n8n node): Queries Gmail for uncategorized emails using the search filter has:nouserlabels to ensure the n8n workflow only acts on new or unprocessed items.
AI Agent (Langchain n8n node): Orchestrates the decision-making process. Its prompt dynamically injects the email content and the Google Sheets category data, compelling the LLM to output a precise category name.
OpenRouter Chat Model (AI Model n8n node): Supplies the intelligence for this n8n automation. It uses a specific, often free, LLM model (like Deepseek) hosted on the OpenRouter service.
Create Label if Doesn't exist (Gmail n8n node): A crucial step that uses error handling (onError: continueRegularOutput) to ensure the n8n workflow is idempotent, creating the label only if it doesn't exist yet.
Filter (Filter n8n node): Matches the plain-text output from the AI agent to the unique system id of the corresponding Gmail label, which is required for the final labeling action.
Use this powerful n8n workflow to automatically categorize and sort incoming Outlook emails using advanced AI models like DeepSeek. Enhance productivity with this ready-to-use n8n template.

Use this powerful n8n workflow to automatically categorize and label incoming Gmail messages (Action, Receipt, Informational, Spam) using GPT-4o, ensuring optimal inbox management.

Automate Zoho Mail organization using an n8n workflow. Classify incoming emails (Support, Leads, Billing) instantly with GPT-4o-mini and apply the correct label using this robust n8n template.

Use this powerful n8n workflow to automatically classify incoming Gmail messages using AI and apply specific labels (Work, Finance, Ads). Find more n8n templates for inbox management.

Use this powerful n8n workflow to automate invoice processing. Schedule checks on Gmail, archive files to Google Drive/SFTP, extract structured data using AI agents, and log everything to Google Sheets. Optimized n8n templates for finance.

Stay up-to-date with new releases using this specialized n8n workflow. This n8n template automatically checks npm for the latest and beta n8n versions, fetches release notes, and sends email notifications via the Gmail n8n node.









































