Mindket

Income and expense log from Gmail invoices and receipts

Newversion 1 · updated

Overview

An n8n workflow that watches Gmail for invoices and receipts. Mistral AI reads the attached file, GPT-4.1 mini decides whether money came in or went out, and a row lands in a Google Sheets ledger with a link to the file in Drive.

Income and expense log from Gmail invoices and receipts is an n8n workflow in the Business category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Google Sheets: the Transactions tab is the log, one row a payment, with the Drive link beside it
  • Google Drive: every attachment it reads sits in the root of your Drive

Platform

Connects 5 apps

How it works

Trigger

New email

It starts when a new email reaches your Gmail inbox, checked every minute:

  • The subject, body and sender
  • Any attached files, of which the first is read

Actions

  1. The first attachment is saved to Google Drive and fetched back
  2. Mistral AI reads the text out of the file
  3. GPT-4.1 mini decides whether the email is about a payment
  4. A second check sorts the payment as income or an expense
  5. An agent pulls out the reference, date, amount, currency and a comment
  6. A row is appended to the Transactions tab, with a link to the file

Result

A Google Sheets log of the payments in your inbox, each row marked income or expense and linked to its file in Drive

Integrations

What you need before you start.

Gmail

Inbox

Checks for new emails every minute and hands over each one with its attachments.

NeedsA Google account to sign in with

Google Drive

File store

Keeps the first attachment of each email and gives the link that goes in the sheet.

NeedsA Google account to sign in with

Mistral AI

Document reader

Runs its OCR model on the attachment and returns the text.

NeedsMistral AI API key

OpenAI

Language model

Runs gpt-4.1-mini for the two checks and for the agents that pull out each payment’s details.

NeedsOpenAI API key

Google Sheets

Ledger

Gives the chart of accounts and takes one row for each payment.

NeedsA Google account to sign in with, and a sheet with two tabs

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
13 steps, starting on a Gmail event
AI
5 steps call an AI model: Extract text, Check for Transaction Email, Check if it’s revenue or expense, Expense AI Agent and Income AI Agent
Sign-ins
Signs in to: Google Drive, Google Sheets, OpenAI and Gmail
API keys
No API key is left in the file
Step types
Mindket’s checker reads 7 of its 8 step types. It does not read: Mistral AI

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow keeps a simple income and expense log from your inbox. It checks Gmail every minute. When an email has a file attached, the first file goes to Google Drive and Mistral AI reads its text. GPT-4.1 mini then decides whether the email is about a payment at all, and if so, whether it is income or an expense. An agent pulls out the date, amount, currency and reference. Then a row goes into a Transactions tab in Google Sheets, with a link to the file. Nineteen nodes do the work. Nothing is paid or sent.

Who it suits

Freelancers and small businesses whose invoices and receipts arrive by email as PDFs. It gives the bookkeeper or accountant a running list to check. You still check each row. Skip it if your payments come as plain emails with no file: as the file comes, those runs stop with an error, and Good to know gives the fix.

Who uses it, and how
IndustryWho uses itHow they use itExample
Freelance and consultingSole tradersLog every client payment and software bill in one sheetA designer’s Stripe payouts and Adobe receipts land in the same Transactions tab.
AgenciesOffice managersKeep supplier invoices and client receipts side by side for the accountantThe agency’s name goes into rule 5, so its own invoices count as income.
E-commerceShop ownersTrack supplier bills and platform fees as they arriveA shop owner checks the month’s expense rows before paying suppliers.
AccountingBookkeepersUse it as a first pass, then correct rows by handA bookkeeper compares each row with its Drive file before entering it.

You need some n8n: importing a file, adding five credentials, making a sheet with two tabs and editing one line of a prompt.

Where to use it

Any n8n that can reach Gmail, Google Drive, Google Sheets, OpenAI and Mistral AI.

  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Google Sheets: the Transactions tab is the log, one row a payment, with the Drive link beside it
  • Google Drive: every attachment it reads sits in the root of your Drive

Setup

Get it saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Make the sheet first.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
GoogleGmail, Drive and Sheets, on one account or several
OpenAIAn API key that can use gpt-4.1-mini
Mistral AIAn API key, for reading the attachments
A sheetA Chart of Accounts tab with your categories, and a Transactions tab with TransactionID, Date, Type, Category, Invoice Link, Amount (with a space after it) and Description
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Add Gmail, Google Drive and Google Sheets credentials and select each in its nodes.
  3. Replace YOUR_SHEET_ID in the three sheet nodes with your sheet’s ID.
  4. Add an OpenAI credential for the four chat model nodes and a Mistral Cloud one for Extract text.
  5. In Check if it’s revenue or expense, replace YOUR_COMPANY_NAME in rule 5 with your business’s name.
  6. Fix the path for emails without an attachment, as Good to know explains.
  7. Send yourself an invoice with a PDF, run it once from the editor, then press Publish.

How to use it

Nothing to start by hand. Once it is published, each new email is checked within a minute. Open the Transactions tab now and then. Read the new rows. Each one links to its file, so you can check a figure in seconds.

What to change for a different result
To changeWhere
What counts as a paymentThe two categories in Check for Transaction Email
Income or expenseThe rules and examples in Check if it’s revenue or expense
What each row holdsEach agent’s field list, its Structured Output Parser and its Add node
How often it checksPoll Times in Gmail Trigger

Example

A software company emails you a receipt with a PDF attached. Mistral reads the PDF, and the first check marks the email as a transaction. The second calls it an expense. The expense agent answers in this shape, here with its values cut:

{ "TransactionID": "…", "Date": "DD/MM/YYYY", "Description": "…", "Amount": "…", "Currency": "…", "Comment": "…" }

A row then goes into Transactions with Type set to Expense and a minus sign before the amount. The description goes in Category, the comment in Description, and the Drive link in Invoice Link.

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. The two classifier nodes each have one line per answer, and an answer with no line simply ends the run. Open a finished run in Executions to see which way each email went.

For experts. Both agents run GPT-4.1 mini with a structured output parser, so their answers come back as fixed JSON. The chart of accounts reaches both classifiers and agents as one aggregated item. The amount header in the file ends with a space, Amount , so match it or rename it.

Good to know

Two vendors bill for every email it reads, and a few details in the file need attention.

  • No attachment, no row: that path skips Extract text and Upload file, yet later nodes read both, so n8n stops the run. Wrapping those reads in isExecuted fixes it
  • The category: the chart of accounts reaches the models, but nothing asks them to choose from it, so Category holds the agent’s own label
  • Every attachment is saved to Drive before the email is checked, each one named attachment_0, and only an email’s first file is read
  • Amounts are text, with the currency symbol in front and a minus sign for expenses
  • Billing: every new email costs at least one GPT-4.1 mini call, and Mistral bills each attachment it reads
  • GPT-4.1 mini: OpenAI removes the snapshot behind gpt-4.1-mini on 14 January 2027 and recommends gpt-6-luna
  • Duplicates: nothing checks the sheet first, so the same email twice means two rows
  • Your data: email text and attachments go to OpenAI and Mistral. Check each row against its file before your books rely on it
  • Credentials: the JSON holds none, and nothing from its author’s sheet

README and files

README

Income and expense log from Gmail invoices and receipts

An n8n workflow for small-business bookkeeping. It watches your Gmail inbox, and when an email arrives with a file attached,
it saves the first attachment to Google Drive and has Mistral AI read the text out of it. GPT-4.1 mini then decides whether the
email is about money at all, and if so, whether the money came in or went out. An agent pulls out the date, amount, currency and
reference, and the workflow adds a row to a Transactions tab in Google Sheets, with a link to the file in Drive.

What is inside

  • workflow.json: the workflow as n8n exports it, nineteen nodes with no sticky notes. It holds no credential.
  • README.md: these notes.

What we changed from the original copy

  • The author's spreadsheet is gone. Read Chart of Accounts, Add Expense to Transactions Sheet and
    Add Income to Transactions Sheet ask for YOUR_SHEET_ID and find their tabs by name: Chart of Accounts and
    Transactions.
  • The income or expense rules in Check if it’s revenue or expense named a company as "my company". That name now reads
    YOUR_COMPANY_NAME, so the model knows which invoices you send and which you receive.
  • Nothing else changed. The original copy needed no backslash repair.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • A Gmail account that receives your invoices and receipts.
  • A Google account with Google Drive and Google Sheets (the same account works).
  • An OpenAI API key that can use gpt-4.1-mini.
  • A Mistral AI API key, for reading the attachments.

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 Trigger.
  3. Add a Google Drive OAuth2 credential and select it in Upload file and Download file.
  4. Make the spreadsheet (below) and copy its ID, the long part of its address between /d/ and /edit. Add a Google Sheets
    OAuth2 credential and select it in the three sheet nodes, then replace YOUR_SHEET_ID in each with the ID.
  5. Add an OpenAI credential and select it in OpenAI Chat Model, OpenAI Chat Model1, OpenAI Chat Model2 and
    OpenAI Chat Model3.
  6. Add a Mistral Cloud credential with your Mistral AI key and select it in Extract text.
  7. Open Check if it’s revenue or expense, find rule 5 in its system prompt and replace YOUR_COMPANY_NAME with your
    business's name.
  8. Read Good to know before you publish. Emails without an attachment stop with an error as the file comes, and the fix is
    given there.
  9. Save, send yourself an invoice with a PDF attached, run the workflow once from the editor, then press Publish.

The spreadsheet

One Google Sheet with two tabs:

  • Chart of Accounts: your categories, one a row, with whatever columns you keep (a name, and income or expense, for
    example). Every row is handed to the models as context.
  • Transactions: the headers TransactionID, Date, Type, Category, Invoice Link, Amount and Description.
    The amount header ends with a space in the file. Type it the same way, or rename the column in both Add nodes.

How a run goes

  1. Gmail Trigger checks the inbox every minute and fetches each new email in full, with its attachments.
  2. If Email Contains Document sends emails with an attachment one way and the rest another.
  3. With an attachment: Upload file saves the first one to the root of your Drive, Download file fetches it back, and
    Extract text sends it to Mistral's OCR model, which returns its text.
  4. Check for Transaction Email reads the extracted text, the subject, the body and the sender. GPT-4.1 mini sorts the email
    as a transaction or not. Anything else stops here.
  5. Read Chart of Accounts and Aggregate Categories turn the categories tab into one list.
  6. Check if it’s revenue or expense sorts the transaction as Expense or Income, using the rules and examples in its prompt.
  7. Expense AI Agent or Income AI Agent pulls out the transaction ID, the date as DD/MM/YYYY, the type, the amount, the
    currency symbol and a comment, as JSON.
  8. Add Expense to Transactions Sheet or Add Income to Transactions Sheet appends a row: the type goes in Category, the
    comment in Description, the currency and amount together in Amount , and the Drive link in Invoice Link.

Change the look

  • What counts as a transaction: the two categories and their descriptions in Check for Transaction Email.
  • Income or expense: the rules and examples in the system prompt of Check if it’s revenue or expense.
  • What it records: the field list in each agent's system message and the example in each Structured Output Parser. Add a
    field in both, then map it in the matching Add node.
  • How often it checks: Poll Times in Gmail Trigger.

Good to know

  • Emails without an attachment fail: that path skips Extract text and Upload file, but the later nodes still read
    $('Extract text').item and $('Upload file').item. n8n stops such a run with "Node 'Extract text' hasn't been executed".
    To fix it, wrap each of those reads in isExecuted, for example
    {{ $('Extract text').isExecuted ? $('Extract text').item.json.extractedText : '' }}. They sit in
    Check if it’s revenue or expense, both agents' prompts and the Invoice Link of both Add nodes.
  • The category: the chart of accounts goes to the models, but nothing asks them to pick from it. Category gets the type
    the agent describes, such as "Subscription Renewal". To get your own names, tell both agents to choose from the chart.
  • Every attachment is saved: the upload happens before the email is checked, so newsletters and tickets land in your Drive too.
    Each file is named attachment_0, since that is the fixed name in Upload file. Only the first attachment of an email is read.
  • Amounts are text: an expense is written as a minus sign, the symbol and the number (-₹140.00), and income as the symbol
    and the number. Sheets may keep them as text, so sums need a helper column.
  • Billing: every new email costs at least one GPT-4.1 mini call, and a transaction up to three. Mistral bills each attachment
    it reads, whether or not it turns out to be a transaction.
  • GPT-4.1 mini: OpenAI's deprecations page, read on 2 November 2026, removes gpt-4.1-mini-2025-04-14, the model behind
    gpt-4.1-mini, on 14 January 2027 and recommends gpt-6-luna. Change the four chat model nodes before then.
  • Both agents' system messages begin with a stray =. The models ignore it.
  • Duplicates: nothing checks the sheet first, so an email that arrives twice is logged twice.
  • Your data: the emails' text and their attachments go to OpenAI and Mistral, and the attachments stay in your Drive. Check
    each row against its file before your books rely on it, since a model can misread a figure or a date.
Files
README.md  7 KB
workflow.json  22 KB

2 files, 29 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-03

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

anaksor-ocr

Sokheng · Kit

Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…

New

Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…

New

ACE-Step 1.5 XL SFT

ACE-Step · Kit

Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…

New

Similar in Business

See all in Business

pplx-decider-v1.1-27b

perplexity-ai · Kit

Picks the best option for a decision from text and images, such as which team should handle a request, with a probability for each choice, for developers who b…

New

NuExtract3

numind · Kit

Reads documents as text or images and fills a JSON template with the fields you ask for, or converts the pages to Markdown. A 4B model for teams that process s…

New

Drex DLM

nace-ai · Kit

Scores yes or no, multiple choice and rating questions about a document in one pass, with a probability for every option. An 8B decision model from Nace.AI tha…

New