Skip to main content

Automated email classification & response system with Gmail, GPT, and Sheets

Workflow preview

Workflow preview
100%
Automated email classification & response system with Gmail, GPT, and Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Email Automation Workflow Template This n8n template demonstrates how to automate email classification, labeling, draft generation, and logging using Gmail, OpenAI, and Google Sheets. Use cases inc...

Best for

  • AI Summarization automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, n8n-nodes-base.stickynote, n8n-nodes-base.gmail, @n8n/n8n-nodes-langchain.textclassifier, n8n-nodes-base.set, n8n-nodes-base.googlesheets, n8n-nodes-base.noop, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Sergio Afonso.

Original n8n.io source

1.1 Workflow description

Title
Automated email classification & response system with Gmail, GPT, and Sheets
Workflow name
Automated email classification & response system with Gmail, GPT, and Sheets

Email Automation Workflow Template

This n8n template demonstrates how to automate email classification, labeling, draft generation, and logging using Gmail, OpenAI, and Google Sheets.
Use cases include customer support management, sales inquiry handling, and keeping track of incoming emails efficiently in a structured way.


Good to know

  • Gmail OAuth2 credentials are required for sending, labeling, and drafting emails.
  • OpenAI credentials are needed for generating draft responses.
  • Google Sheets must have Logs and Errors sheets with the correct columns (Original Email, Decision, Output Email for Logs; Node with Error, Error Message, Time, Execution ID, Workflow ID for Errors).
  • The workflow is designed to handle multiple emails simultaneously and continues even if a node fails.

How it works

  1. The workflow is triggered by new emails in Gmail.
  2. Emails are classified into categories: Support, Sales, Complaints, Information, or Other.
  3. Based on the classification:
    • Support and Sales emails → Draft response generated with OpenAI and labeled in Gmail.
    • Complaints, Information, and Other → Emails labeled accordingly.
  4. All processed emails and generated outputs are logged in Google Sheets (Logs).
  5. Any workflow errors are captured in the Errors sheet for debugging.

How to use

  • Test with a sample email to confirm classification, draft generation, labeling, and logging work correctly.
  • Update Google Sheets nodes with your document ID and sheet names.

Requirements

  • Gmail account with OAuth2 credentials
  • OpenAI account for draft generation
  • Google Sheets account for logging

Customizing this workflow

  • Add new email categories or refine existing ones.
  • Adjust draft responses or templates for Support/Sales.
  • Integrate with other apps or systems for more advanced automation (e.g., CRM updates, notifications).

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 2 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - compliants label

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 6 - info label

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 7 - other label

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 8 - Mail Classifier

Type / Role
@n8n/n8n-nodes-langchain.textClassifier - textClassifier
Config choices
Version 1.1

Block 9 - Set 2

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 10 - Set 3

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Set 4

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Google Sheets2

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 16 - Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 17 - No Operation, do nothing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 18 - No Operation, do nothing1

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 19 - Sticky Note10

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note11

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note12

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note13

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Add label to thread

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 24 - Create a draft: Sales

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Showing the first 24 of 35 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automated email classification & response system with Gmail, GPT, and Sheets
Complexity advanced
Nodes 35
Categories AI Summarization, Multimodal AI
Author Sergio Afonso
Published 25 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7839/7839.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automated email classification & response system with Gmail, GPT, and Sheets do?

Email Automation Workflow Template This n8n template demonstrates how to automate email classification, labeling, draft generation, and logging using Gmail, OpenAI, and Google Sheets. Use cases inc...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI Summarization, Multimodal AI use case.