Latenode

Automatically sort and categorize Gmail emails using AI

This template starts on a new Gmail message, reads your category list from Google Sheets, and asks ChatGPT which label fits the subject and body.

Gmail then applies that label. Keep the category names in the sheet so you can change them without editing the scenario. Connect Gmail and Google Sheets. ChatGPT is a Latenode AI step, so you do not paste an OpenAI key.

Updated Sep 16, 2026Est. run: 21sEst. cost: $0.0013
How Latenode estimates time and cost

Latenode bills workflow runtime in CPU seconds. The first 10,000 CPU seconds are free each month, then usage follows pay-as-you-go CPU-second pricing. Plug-and-Play (PnP) AI nodes are billed separately—each PnP token is $1 USD, charged pay-as-you-go at vendor cost plus a small processing fee, with no API keys required.

Full pricing — how CPU seconds work →

Workflow preview

What this template does

  • Labels new Gmail messages as they arrive
  • Keeps category names in Google Sheets
  • Classifies with ChatGPT from subject and body
  • Applies the matching Gmail label

How it works

1
Trigger

Watch Gmail

The scenario starts when a new email arrives in the mailbox you connect.

2
Action

Load categories from Sheets

Google Sheets returns the category names and short rules you maintain in the tab.

3
AI

Classify with ChatGPT

ChatGPT reads the subject and body against those categories and returns one label name.

4
Action

Apply the Gmail label

Gmail adds that label to the message. Create the label first if it does not exist yet.

Setup guide

1

Connect Gmail

Add a Gmail connection for the inbox you want to sort. Watch new email on that mailbox.

2

Connect Google Sheets

Add a Google Sheets connection. Put category names and a one-line rule for each in a tab Latenode can read.

3

Add ChatGPT and labels

Send subject, body, and the category list to ChatGPT. Map the returned name onto Add Labels on the Gmail message. Create the label if Gmail does not have it yet. Send a test email and confirm the label appears. ChatGPT is a Latenode AI node.

Requirements

A Gmail mailbox Latenode can read and label
A Google Sheet with category names and short rules
Permission to create Gmail labels if a category is new

FAQ

Common questions about this template

Each run uses credits on your Latenode plan. We charge for processing time (1 credit = 30 seconds). Your actual cost depends on your plan and how long the run takes. See pricing plans for plans and how credits work. Plug-and-Play AI nodes are billed separately.