---
title: "New Gmail emails sorted by AI and logged to Google Sheets"
kind: "Kit"
category: "Productivity"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/16e772b1-e356-45f7-be3d-000c66c89afd"
updated: "2026-11-12"
---

# New Gmail emails sorted by AI and logged to Google Sheets

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow that picks up new unread Gmail messages, asks GPT to label each as urgent, important, informational or spam with a one-line summary, and logs it in a Google Sheet. It moves and deletes nothing.

New Gmail emails sorted by AI and logged to Google Sheets is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow sorts your new unread email and keeps a log of it. Every minute it picks up new unread messages in Gmail. A Code step keeps the sender, the subject, the date and the first 500 characters of the body. GPT labels each message as urgent, important, informational or spam and writes a one-sentence summary as JSON. A second Code step joins the answer to its email, and Google Sheets adds a row. Nothing is moved, labelled, deleted or answered. Five nodes run it, beside one sticky note.

### Who it suits

Anyone with a busy inbox who wants to see how an AI would sort it before they let it act. Skip it if you want mail moved or labelled on its own. This one only logs. Each message goes to OpenAI.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Operations | Team leads | Check what an assistant would flag before they give it any power | A lead reads the log and sees which urgent mail the model caught. |
| Support | Shared inboxes | Measure how much of the inbox is spam or news | A support lead counts the categories after a week. |
| Sales | Account managers | Spot important mail among long threads | A manager filters the sheet for important and acts on those first. |
| Freelance | Independent workers | Get a daily list of what arrived | A freelancer reads one-line summaries instead of every message. |

You need to know n8n’s settings: import a file, add three credentials and name a sheet.

### Where to use it

Any n8n that can reach Gmail, OpenAI and Google Sheets will run it.

- n8n Cloud: import the file and publish it
- Your own n8n server: the same file and steps
- Google Sheets: one tab called \`Email log\` with five named columns

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. Setup is three credentials and one sheet id.

What you need first

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server of your own |
| Gmail | An OAuth2 credential for the mailbox to sort |
| OpenAI | An API key. The model is \`gpt-6-luna\` |
| Google Sheets | An OAuth2 credential and a tab called \`Email log\` with the columns Date, From, Subject, Category and Summary |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. Add a Gmail credential and select it in `Gmail: New Email`.
3. Add an OpenAI credential and select it in `AI: Classify`.
4. Add a Google Sheets credential and select it in `Log to Sheets`. Replace `<YOUR_SHEET_ID>` with your sheet’s id.
5. Publish the workflow, then send yourself a test email from another address.

### How to use it

Leave it running and open the sheet when you want to see what came in. Read the first rows to judge whether the categories fit your mail, then change the prompt if they do not.

What to change for a different result

| To change | Where |
| --- | --- |
| Which mail is looked at | The filters in \`Gmail: New Email\` |
| The categories and the summary | The system message in \`AI: Classify\` |
| How much of the body the model sees | The length in \`Parse Email\` |
| The columns | The mapping in \`Log to Sheets\`, and row 1 of your tab |

### Example

A message arrives with the subject “Contract needs your signature today”.

```text
{"category": "urgent", "summary": "A contract is waiting for your signature by the end of today."}
```

The sheet gets a row with the date, the sender, the subject, the category urgent and that one-line summary.

### For newcomers and experts

**If you are new.** n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. This one reads mail, asks a model to label it and writes a row. Start by sending yourself two or three test emails.

**For experts.** Two Code steps wrap one call to the model.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Gmail: New Email\` | Trigger on unread mail, full parse | One item for each new message |
| \`Parse Email\` | Keeps sender, subject, date and 500 characters | It handles every item of a check |
| \`AI: Classify\` | OpenAI node with JSON output on | The answer comes back as an object |
| \`Merge Result\` | Pairs each answer with its email | An unreadable answer becomes informational |
| \`Log to Sheets\` | Appends the row | Row 1 must hold the five names |

### Good to know

The category is a guess, so read the first rows before you rely on them.

- Fixes: the AI step used a node type that does not exist at that version, so it is now n8n’s OpenAI node. The original also handled only the first email of each check, and it read a snippet field that the full output lacks
- Model: \`gpt-4o-mini\` shuts down on 14 January 2027, so this copy asks for \`gpt-6-luna\` and leaves out the temperature and the token limit
- Cost and data: each email is one call to OpenAI with the sender, the subject and 500 characters of the body
- Read status: the workflow marks nothing as read, so the unread filter only limits what each check fetches
- Sheet: row 1 must hold \`Date\`, \`From\`, \`Subject\`, \`Category\` and \`Summary\`, or the sheet step stops
- Not run: Mindket did not run it against Gmail, OpenAI or Google Sheets
- Credentials: the JSON holds none

## README

```markdown
# New Gmail emails sorted by AI and logged to Google Sheets

An n8n workflow that sorts your new unread email and keeps a log. Every minute it picks up new unread messages in
Gmail. A model labels each one as urgent, important, informational or spam and writes a one-sentence summary. The result
goes into a Google Sheet. It is the safe first step: nothing is moved, deleted, labelled or answered.

## What is inside

- `workflow.json`: the workflow as n8n exports it, six nodes. One is a sticky note. It holds no credential.
- `README.md`: these notes.

## What we changed from the original copy

- The AI step was an `n8n-nodes-base.openAi` node at version 1.8. That node type only exists at versions 1 and 1.1, and
  its options differ. `AI: Classify` is now n8n's OpenAI node, which has version 1.8, with its Message a Model operation and
  JSON output turned on.
- The model was `gpt-4o-mini`, which OpenAI shuts down on 14 January 2027. It now asks for `gpt-6-luna`, the replacement
  OpenAI names. The temperature of 0.2 and the limit of 200 tokens are gone. The model's page does not list a temperature
  setting, and OpenAI counts a reasoning model's thinking against the output limit, so a small cap can cut the answer off.
- `Parse Email` handled only the first email of each check. When several emails arrive between two checks, the others were
  lost. It now handles all of them, and `Merge Result` pairs each answer with its email.
- The snippet was read from a field that the full email output does not have, so the model saw only the sender and the
  subject. It now falls back to the start of the plain text.
- `Merge Result` expected the answer as text. The OpenAI node now returns it as an object, so the code takes either.
- The sheet id came from an environment variable, which only a self-hosted n8n can set. It is now
  the placeholder `<YOUR_SHEET_ID>`. The tab is `Email log`, and the node lists its five columns.
- The sticky note has a shorter title and a plainer last line.

## Before you start

- A Gmail account you can connect to n8n with OAuth2.
- An OpenAI API key.
- A Google Sheet with a tab called `Email log`. Row 1 holds these names: `Date`, `From`, `Subject`, `Category` and
  `Summary`. If one is missing, the sheet step stops.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. Add a Gmail OAuth2 credential and select it in `Gmail: New Email`.
3. Add an OpenAI credential and select it in `AI: Classify`.
4. Add a Google Sheets OAuth2 credential and select it in `Log to Sheets`. Replace `<YOUR_SHEET_ID>` with your sheet's id,
   the part of its address between `/d/` and `/edit`.
5. Publish the workflow, then send yourself a test email from another address.

## How a run goes

1. `Gmail: New Email` fetches new unread messages and parses them in full.
2. `Parse Email` keeps the message id, the sender's address and name, the subject, the first 500 characters of the body and
   the date.
3. `AI: Classify` asks the model for JSON with a `category` and a `summary`. The category is urgent, important,
   informational or spam.
4. `Merge Result` joins each answer with its email. If an answer cannot be read, the email is logged as informational with
   no summary.
5. `Log to Sheets` appends a row to the `Email log` tab.

## Change the result

- Which mail is looked at: the Read Status and other filters in `Gmail: New Email`.
- The categories and the summary: the system message in `AI: Classify`, and the fallback in `Merge Result`.
- How much of the body the model sees: the `substring` length in `Parse Email`.
- The columns: the mapping in `Log to Sheets` and row 1 of your tab.

## Good to know

- The workflow marks nothing as read. The unread filter only limits which mail is fetched at each check.
- Each new email is one call to OpenAI. It sends the sender, the subject and the start of the body.
- The model's category is a guess. Read the first rows before you trust them.
- Mindket did not run this workflow against Gmail, OpenAI or Google Sheets. These notes follow n8n's published node code
  and OpenAI's pages, read on 12 November 2026, and the two Code steps were run on sample emails on a local computer.
```

## What is in it

3 files, 11 KB, downloaded as a zip.

```text
NOTICE.md  628 B
README.md  4 KB
workflow.json  6 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- Steps: 5 steps, starting on a Gmail event
- AI: 1 step calls an AI model: AI: Classify
- Sign-ins: Signs in to: Google Sheets and Gmail
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads all 4 of its step types

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/16e772b1-e356-45f7-be3d-000c66c89afd)
- [Its page on Mindket](https://mindket.com/p/16e772b1-e356-45f7-be3d-000c66c89afd)
