# Financial document extraction from Gmail to Google Sheets: n8n workflow

> Started by an arriving email, and works across Gmail and Google Sheets. It hands the judgement calls to Gemini and OpenAI.

Source: https://millionrounds.com/workflow/financial-document-extraction-from-gmail-to-google-sheets (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Financial document extraction from Gmail to Google Sheets

Started by an arriving email, and works across Gmail and Google Sheets. It hands the judgement calls to Gemini and OpenAI. 20 steps, 3 branches: a working afternoon to understand properly.

Medium Calls a model: Gemini, OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ffinancial-document-extraction-from-gmail-to-google-sheets)

**20 steps** Medium: a working afternoon

**3** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Model 5 Logic 7 Service 7

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

- 1 **Look for Invoices** Gmail trigger *Starts it*
- 2 **gpt 4o mini** Lm Chat Open Ai *Model*
- 3 **Gemini 2.5 flash** Lm Chat Google Gemini *Model*
- 4 **Get Email Content** Gmail *Service*
- 5 **AI Agent (PDF OCR)** Agent *Model*
- 6 **AI Agent (Email OCR)** Agent *Model*
- 7 **Guardrail: Is Finance?** Guardrails *Model*
- 8 **Validate Extraction** Code *Logic*
- 9 **Configuration: User Settings** Set *Logic*
- 10 **Check for Errors** If *Logic*
- 11 **IF (Guardrail Passed)** If *Logic*
- 12 **Apply Finance Rules** Code *Logic*
- 13 **Log Error to Sheet** Google Sheets *Service*
- 14 **Filter Finance Keywords** Filter *Logic*
- 15 **Log to Invoices Sheet** Google Sheets *Service*
- 16 **Send Error Notification** Gmail *Service*
- 17 **Check for Attachment** If *Logic*
- 18 **Send Confirmation Email** Gmail *Service*
- 19 **Extract PDF Data** Extract From File *Service*
- 20 **Log Success Metrics** Google Sheets *Service*

## How it's built

- **Starts on:** An arriving email
- **Steps:** 20, with 3 branches
- **Size:** Medium: a working afternoon
- **Connects to:** Gmail, Google Sheets
- **Model:** Gemini, OpenAI

## Questions

What does it need to run?

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

What starts it?

It starts on an arriving email.

Does it use AI?

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

How long does it take to set up?

Plan an afternoon. 20 steps is enough that you should read each one before running it.

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 20 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%2Ffinancial-document-extraction-from-gmail-to-google-sheets)
- **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.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Generate DOCX documents from Gmail with OpenAI** 20 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/generate-docx-documents-from-gmail-with-openai)
- [**Organize handwritten memos from LINE with Gemini and Drive** 20 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/organize-handwritten-memos-from-line-with-gemini-and-drive)
- [**Automated database backup with Google Sheets and Slack** 20 steps · Google Sheets, Slack](https://millionrounds.com/workflow/automated-database-backup-with-google-sheets-and-slack)
- [**Extract and triage PDF documents with Claude and Gmail** 20 steps · Airtable, Gmail](https://millionrounds.com/workflow/extract-and-triage-pdf-documents-with-claude-and-gmail)
- [**Translate PDFs into multiple languages with Google Translate** 20 steps · Gmail, n8n data table](https://millionrounds.com/workflow/translate-pdfs-into-multiple-languages-with-google-translate)
- [**Evaluation metric example: RAG document relevance with OpenAI** 19 steps · calls a model · Google Sheets, in-memory vectors](https://millionrounds.com/workflow/evaluation-metric-example-rag-document-relevance-with-openai)
