AI Summarization and Smart Logging for Filtered Emails - n8n Workflow

Use this powerful n8n workflow to filter incoming Gmail messages, summarize content using Groq AI, and automatically log key data to Google Sheets. This n8n workflow is one of the best n8n templates for maximizing productivity.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Executives & Managers: Who need concise, instant summaries of mission-critical emails without reading the full body.
Technical Users: Looking for advanced n8n templates that combine code processing, conditional logic, and external AI services (Groq/LLMs).
Productivity Enthusiasts: Anyone aiming to build robust, serverless backends for email processing using a flexible n8n workflow.
Data Analysts: Needing structured logs of specific communications automatically stored in Google Sheets.

Overview

This automation solves the problem of information overload by intelligently processing high-priority emails. Instead of manually reviewing long email threads, this robust n8n workflow acts as a personalized email agent. When a new email arrives via the n8n trigger, it is first cleaned and parsed by a custom n8n node, filtered by a specific sender, and then subjected to state-of-the-art AI summarization using Groq's low-latency models. The concise AI summary, along with key metadata (Sender, Subject, Date), is then immediately logged to Google Sheets. This highly efficient n8n workflow ensures only relevant information is extracted and stored, making data retrieval and review instantaneous. If you are looking for advanced n8n templates for Gmail management, this is a prime example.

How it Works

The process begins with the Gmail Trigger n8n node, which continuously polls for new emails, specifically focusing on the 'CATEGORYPERSONAL' label.


  1. Data Extraction & Cleaning: The incoming email payload is passed to a custom Code n8n node (info1). This node performs crucial preparation: it extracts sender name/email, formats the date, and cleans the email content (converting HTML to plain text and truncating it if it exceeds 5000 characters).

  2. Conditional Filtering: An If n8n node (Check Valid Email) checks the extracted 'Sender Name'. The workflow proceeds only if the sender name matches the user-defined filter (YOURSENDERNAMEFILTER).

  3. AI Summarization Setup: The validated email data feeds into the AI Agent n8n node, where the user-defined prompt instructs the AI to generate a 'very short, concise summary' of the email content.

  4. LLM Execution: The Groq Chat Model n8n node provides the necessary processing power, executing the summarization request using the high-speed llama-3.1-8b-instant model.

  5. Logging Results: Finally, the Google Sheets n8n node takes the original email metadata (Date, Subject, Sender) combined with the AI-generated output ($json.output) and logs a new row, providing a complete, summarized record of the prioritized communication.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import: Copy the full JSON code and import it into your n8n instance using the 'New' > 'Import from JSON' function.

  2. Gmail Credentials: Set up your Gmail Trigger credentials. Ensure the trigger is configured to poll based on your desired schedule and label criteria (CATEGORYPERSONAL is currently selected).

  3. Filtering Setup: In the Check Valid Email n8n node (If node), replace the placeholder YOURSENDERNAMEFILTER with the exact sender name you wish to monitor.

  4. Groq Setup: Configure the Groq Chat Model credentials using your Groq API key.

  5. Google Sheets Setup:

Create a new Google Sheet document with columns for 'sender name', 'sender email', 'subject', 'summary', and 'Date'.
Add your Google Sheets credentials to the Log to Google Sheets n8n node.
* Paste the Document URL (or Document ID) and confirm the target Sheet Name (e.g., 'Sheet1').

  1. Activate: Save and activate the n8n workflow. Run a test manually to verify the filtering, summarization, and data logging functions of this n8n template.

Node Details

Gmail Trigger: This n8n trigger initiates the automation upon receiving new emails. Key configuration involves setting the polling frequency and filtering by Gmail labels (set to CATEGORYPERSONAL).
Code (info1): A custom n8n node dedicated to parsing. Its function is to reliably extract the sender's details and clean the email body, converting complex HTML content into readable plain text for the AI, ensuring optimal input quality.
If (Check Valid Email): This corelogicflowcontrol n8n node applies a conditional filter, ensuring only emails matching a specific 'Sender Name' proceed to the costly AI processing steps.
AI Agent1: Defines the core task logic. It dynamically injects the cleaned email content into the LLM prompt, instructing the model to generate a 'very short, concise summary'.
Groq Chat Model1: The large language model n8n node responsible for executing the summarization. It uses the llama-3.1-8b-instant model for rapid processing.
Google Sheets (Log to Google Sheets1): The final action n8n node. It connects the Date, Subject, Sender information (from info1 output), and the AI summary (from the upstream AI output) to append a new, highly structured row in the target Google Sheet.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
ARRE
ARRE

Automation Architect | I transform complexity into simplicity Building intelligent n8n workflows that do your heavy lifting in minutes, not hours. My mission: Eliminate repetitive tasks, streamline your operations, and give you back the most valuable resource – your time. Let’s make work feel lighter together.

Featured*