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…
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.
New email
It starts when a new email reaches your Gmail inbox, checked every minute:
A Google Sheets log of the payments in your inbox, each row marked income or expense and linked to its file in Drive
What you need before you start.
Inbox
Checks for new emails every minute and hands over each one with its attachments.
NeedsA Google account to sign in with
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
Document reader
Runs its OCR model on the attachment and returns the text.
NeedsMistral AI API key
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
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
Checked by Mindket on 13 Nov 2026
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.
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.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Freelance and consulting | Sole traders | Log every client payment and software bill in one sheet | A designer’s Stripe payouts and Adobe receipts land in the same Transactions tab. |
| Agencies | Office managers | Keep supplier invoices and client receipts side by side for the accountant | The agency’s name goes into rule 5, so its own invoices count as income. |
| E-commerce | Shop owners | Track supplier bills and platform fees as they arrive | A shop owner checks the month’s expense rows before paying suppliers. |
| Accounting | Bookkeepers | Use it as a first pass, then correct rows by hand | A 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.
Any n8n that can reach Gmail, Google Drive, Google Sheets, OpenAI and Mistral AI.
Get it saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Make the sheet first.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server of your own |
| Gmail, Drive and Sheets, on one account or several | |
| OpenAI | An API key that can use gpt-4.1-mini |
| Mistral AI | An API key, for reading the attachments |
| A sheet | A 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 |
workflow.json.YOUR_SHEET_ID in the three sheet nodes with your sheet’s ID.Extract text.Check if it’s revenue or expense, replace YOUR_COMPANY_NAME in rule 5 with your business’s name.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.
| To change | Where |
|---|---|
| What counts as a payment | The two categories in Check for Transaction Email |
| Income or expense | The rules and examples in Check if it’s revenue or expense |
| What each row holds | Each agent’s field list, its Structured Output Parser and its Add node |
| How often it checks | Poll Times in Gmail Trigger |
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.
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.
Two vendors bill for every email it reads, and a few details in the file need attention.
Extract text and Upload file, yet later nodes read both, so n8n stops the run. Wrapping those reads in isExecuted fixes itCategory holds the agent’s own labelattachment_0, and only an email’s first file is readgpt-4.1-mini on 14 January 2027 and recommends gpt-6-lunaAn 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.
workflow.json: the workflow as n8n exports it, nineteen nodes with no sticky notes. It holds no credential.README.md: these notes.Read Chart of Accounts, Add Expense to Transactions Sheet andAdd Income to Transactions Sheet ask for YOUR_SHEET_ID and find their tabs by name: Chart of Accounts andTransactions.Check if it’s revenue or expense named a company as "my company". That name now readsYOUR_COMPANY_NAME, so the model knows which invoices you send and which you receive.gpt-4.1-mini.workflow.json.Gmail Trigger.Upload file and Download file./d/ and /edit. Add a Google SheetsYOUR_SHEET_ID in each with the ID.OpenAI Chat Model, OpenAI Chat Model1, OpenAI Chat Model2 andOpenAI Chat Model3.Extract text.Check if it’s revenue or expense, find rule 5 in its system prompt and replace YOUR_COMPANY_NAME with yourOne Google Sheet with two tabs:
TransactionID, Date, Type, Category, Invoice Link, Amount and Description.Add nodes.Gmail Trigger checks the inbox every minute and fetches each new email in full, with its attachments.If Email Contains Document sends emails with an attachment one way and the rest another.Upload file saves the first one to the root of your Drive, Download file fetches it back, andExtract text sends it to Mistral's OCR model, which returns its text.Check for Transaction Email reads the extracted text, the subject, the body and the sender. GPT-4.1 mini sorts the emailRead Chart of Accounts and Aggregate Categories turn the categories tab into one list.Check if it’s revenue or expense sorts the transaction as Expense or Income, using the rules and examples in its prompt.Expense AI Agent or Income AI Agent pulls out the transaction ID, the date as DD/MM/YYYY, the type, the amount, theAdd Expense to Transactions Sheet or Add Income to Transactions Sheet appends a row: the type goes in Category, theDescription, the currency and amount together in Amount , and the Drive link in Invoice Link.Check for Transaction Email.Check if it’s revenue or expense.Structured Output Parser. Add aAdd node.Gmail Trigger.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".isExecuted, for example{{ $('Extract text').isExecuted ? $('Extract text').item.json.extractedText : '' }}. They sit inCheck if it’s revenue or expense, both agents' prompts and the Invoice Link of both Add nodes.Category gets the typeattachment_0, since that is the fixed name in Upload file. Only the first attachment of an email is read.-₹140.00), and income as the symbolgpt-4.1-mini-2025-04-14, the model behindgpt-4.1-mini, on 14 January 2027 and recommends gpt-6-luna. Change the four chat model nodes before then.=. The models ignore it.README.md 7 KB workflow.json 22 KB
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…
Qwen · Kit
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…
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…
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…
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…
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…