# Track and classify expenses with Mindee OCR and OpenAI: n8n workflow

> Started by someone submitting a form, and works across Google Drive, Postgres and Slack. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/track-and-classify-expenses-with-mindee-ocr-and-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

# Track and classify expenses with Mindee OCR and OpenAI

Started by someone submitting a form, and works across Google Drive, Postgres and Slack. It hands the judgement calls to OpenAI. 32 steps, 4 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-and-classify-expenses-with-mindee-ocr-and-openai)

**32 steps** Large: read it before trusting it with anything live

**4** Branches: places the flow splits

**1** Loop or waits

**3** Services it connects to

## The flow

Starts it 2 Model 1 Logic 15 Service 14

The steps in the order they run, from what starts it.

- 1 **Expense Upload Form** Form trigger *Starts it*
- 2 **Daily Analytics Scheduler** Schedule trigger *Starts it*
- 3 **Validate Receipt File** Code *Logic*
- 4 **Calculate Monthly Spending** Postgres *Service*
- 5 **Generate Category Analytics** Postgres *Service*
- 6 **Generate Merchant Analytics** Postgres *Service*
- 7 **Calculate Expense Split** Postgres *Service*
- 8 **Submit Receipt To Mindee** Http Request *Service*
- 9 **Upload Receipt To Drive** Google Drive *Service*
- 10 **Merge Analytics Results** Merge *Logic*
- 11 **Validate OCR Job** If *Logic*
- 12 **OCR Failure Alert** Slack *Service*
- 13 **Extract Drive File URL** Code *Logic*
- 14 **Build Dashboard Summary** Code *Logic*
- 15 **Wait Before Polling** Wait *Logic*
- 16 **Stop Workflow On OCR Failure** Stop And Error *Logic*
- 17 **Combine OCR + AI + File Data** Merge *Logic*
- 18 **Send Analytics Dashboard** Slack *Service*
- 19 **Fetch OCR Result** Http Request *Service*
- 20 **Final Expense Validation** Code *Logic*
- 21 **Extract OCR Fields** Code *Logic*
- 22 **AI Validation Passed?** If *Logic*
- 23 **Validate Extracted Expense** Code *Logic*
- 24 **Search Duplicate Expense** Postgres *Service*
- 25 **Invalid Expense Alert** Slack *Service*
- 26 **Expense Data Valid?** If *Logic*
- 27 **Duplicate Expense Found?** If *Logic*
- 28 **AI Expense Classification** Open Ai *Model*
- 29 **Duplicate Expense Alert** Slack *Service*
- 30 **Save Expense Record** Postgres *Service*
- 31 **Parse AI Classification** Code *Logic*
- 32 **Expense Processed Notification** Slack *Service*

## How it's built

- **Starts on:** Someone submitting a form
- **Steps:** 32, with 4 branches, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Drive, Postgres, Slack
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Google Drive, Postgres and Slack accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone submitting a form.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 32 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 32 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-and-classify-expenses-with-mindee-ocr-and-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)[Slack](https://millionrounds.com/workflows?service=Slack#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**Automated expense tracking with Google Sheets** 31 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/automated-expense-tracking-with-google-sheets)
- [**Invoice verification and validation with Gmail and Drive** 34 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/invoice-verification-and-validation-with-gmail-and-drive)
- [**Generate leads and proposals [FREE SYSTEM] with Gmail** 30 steps · Gmail, Google Drive](https://millionrounds.com/workflow/generate-leads-and-proposals-free-system-with-gmail)
- [**Manage restaurant orders, upsells, and payments with Telegram** 29 steps · calls a model · Google Sheets, Slack](https://millionrounds.com/workflow/manage-restaurant-orders-upsells-and-payments-with-telegram)
- [**Approve invoices with Claude and Google Drive** 28 steps · Google Drive, Google Sheets](https://millionrounds.com/workflow/approve-invoices-with-claude-and-google-drive)
- [**Kick off client projects after Stripe payment** 28 steps · ClickUp, Gmail](https://millionrounds.com/workflow/kick-off-client-projects-after-stripe-payment)
