Detect phishing and triage Gmail with Google Gemini and 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.
What this workflow does
This AI workflow has 13 nodes and runs on Gmail events. Along the way it connects Gmail, Google Gemini Chat Model and Google Sheets.
How it runs
Trigger: On Gmail events.
- Set log sheet details (Edit Fields (Set)): sets 2 fields: logSheetId, logSheetName
- Get all Gmail labels (Gmail): work with label
- Match categories to label IDs (Code): runs custom JavaScript code
- Classify email with AI agent (AI Agent): runs an AI agent, with model: Google Gemini Chat Model; 5 tools (Add 'Ads' label, Add 'Review' label, Add 'Urgent' label, Add 'Not Important' label…)
- Combine email with AI result (Merge): merges the data from its input branches
- Log result to Google Sheet (Google Sheets): append
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Gmail
n8n-nodes-base.gmail - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Gmail Tool
n8n-nodes-base.gmailTool - Merge
n8n-nodes-base.merge - Google Sheets
n8n-nodes-base.googleSheets
From the author
Quick overview Watches Gmail for new unread mail, then an AI agent on Google Gemini sorts each one into a category — including a phishing/fraud check — and applies the matching Gmail label itself. Every result gets logged to Google Sheets with sender,…