Skip to main content

Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini

Workflow preview

Workflow preview
100%
Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini preview
Open on n8n.io

1. Workflow Overview

This n8n template demonstrates how to automatically process invoice attachments from email using OCR and AI. When an invoice is received in Gmail, the workflow extracts structured invoice data and ...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.gmailtrigger, n8n-nodes-base.if, n8n-nodes-base.noop, n8n-nodes-base.httprequest, n8n-nodes-base.mistralai, @n8n/n8n-nodes-langchain.agent

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Safa Khan.

Original n8n.io source

1.1 Workflow description

Title
Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini
Workflow name
Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini

This n8n template demonstrates how to automatically process invoice attachments from email using OCR and AI. When an invoice is received in Gmail, the workflow extracts structured invoice data and stores it in Airtable while preventing duplicates.

This automation is useful for freelancers, agencies, and finance teams who receive invoices by email and want to maintain a structured invoice database without manual data entry.

Who’s it for

This workflow is designed for:

Freelancers managing client invoices

Agencies handling multiple invoice emails

Finance teams automating invoice intake

Automation consultants building accounting workflows

How it works

When a new email with an attachment arrives in Gmail, the workflow checks whether the subject contains the word “invoice”. The attachment is uploaded to an image-hosting service to generate a public URL.

The invoice file is then processed using OCR to extract text content. An AI agent analyzes the extracted text and converts it into structured invoice fields such as invoice number, sender, recipient, dates, description, and amount.

Before saving, Airtable is searched to ensure the invoice does not already exist. Valid invoices are stored automatically, while invalid data triggers an error notification email.

How to set up

  • Connect Gmail credentials and enable attachment download.

  • Connect Airtable credentials and create an invoice table.

  • Add your imgbb API key in the HTTP Request node.

  • Connect your OCR provider (Mistral).

  • Connect your OpenAI API credentials.

  • Activate the workflow and send a test invoice email.

Requirements

  • Gmail account

  • Airtable account

  • OpenAI API key

  • Mistral OCR API key

  • imgbb API key

  • n8n instance (cloud or self-hosted)

How to customize the workflow

You can customize this workflow by:

Modifying the AI prompt used for invoice extraction

Adding new invoice fields in Airtable

Changing validation rules

Supporting additional invoice formats (PDF, PNG, JPG)

Adding integrations with accounting tools like QuickBooks or Stripe

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 2 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 3 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.3

Block 4 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 5 - No Operation, do nothing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 6 - host image

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - Extract text

Type / Role
n8n-nodes-base.mistralAi - mistralAi
Config choices
Version 1

Block 8 - Download Invoice

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.4

Block 9 - Analyze Invoices

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 10 - Search Existing Invoices

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2

Block 11 - Check for Duplicates

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3

Block 12 - Validate Data

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 13 - Invalid Data Handler

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 14 - Send Error Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 15 - No Operation, do nothing1

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 16 - upload invoice & details

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 17 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini
Complexity advanced
Nodes 25
Categories Invoice Processing, AI Summarization
Author Safa Khan
Published 17 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13469/13469.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Extract invoice data from Gmail to Airtable with Mistral OCR and GPT-4.1-mini do?

This n8n template demonstrates how to automatically process invoice attachments from email using OCR and AI. When an invoice is received in Gmail, the workflow extracts structured invoice data and ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.