Extract & Process Invoices with Gemini AI, Google Sheets & Gmail Notifications — n8n Workflow

High complexity Trigger16 nodes🏷️ Invoice Processingby Yashraj singh sisodiya

Overview

AI-Powered Invoice Extraction & Automation System Workflow

Aim

The aim of the Invoice Data Automation workflow is to streamline invoice processing by extracting, validating, and storing invoice details automatically. It uses AI to read invoices (from images/PDFs), structures the data in JSON, checks for missing or duplicate entries, and records the information in a Google Sheet while also uploading the original invoice to Google Drive. Additionally, it sends email notifications for successful

Nodes used

Google SheetsGoogle DriveGmailCodeAI AgentGoogle Gemini Chat ModelGoogle Gemini

Workflow Preview

Node 1: When chat message received
This is a *trigger node* that starts the workflow whene
It supports file uploads, meaning users can directly se
Node 3: AI Agent1
This node acts as an AI processing step that takes the
It applies a *system message* that defines cle
Node 2: Analyze image1
This node uses *Google Gemini (PaLM API)* to analyze th
It takes the binary file (`data0`) and processes it thr
Node 4: Google Gemini Chat Model1
This node provides the language model backend for the A
It connects to Google Gemini (PaLM API) and powers the
Node 6: Get data
This node connects to a Google Sheet that acts as the *
It performs a lookup using the `Entry_ID` column and co
Node 5: Make data in JSON structure format
This node is a Set node that organizes the AI Agent’s o
It assigns the extracted invoice data to a single field
Node 8: New data add using payload
This node is a Code node that ensures proper handling o
It first checks if the Google Sheets lookup returned an
Node 9: Check Mandatory fields
This is a Code node that validates the invoice data.
It checks if all *mandatory fields* (`invoice_id`, `sho
Node 10: If – check missing field
This is an If node that decides the workflow path based
It checks the `status` field returned by the *Check Man
Node 11: no missing field – new data add usin
This is a Code node that passes forward only the valid
It retrieves the structured payload
Node 12: Append data to sheet
This node writes the validated invoice data into the Go
It uses the *append* operation to add a new row with ma
Node 13: Send successful email
This node sends a confirmation email via Gmail once a n
The email includes key details like *Invoice ID, Compan
Node 7: check if Data exist or not in table
This is an If node that checks whether the invoice alre
It does this by verifying if the `Get data` node return
Node 8.1: Duplicate entry send mail
This node sends an email notification via Gmail when an
The email is formatted in *HTML* and includes details l
Node 11.1: Send missing field error on mail
This node sends an error notification email via Gmail w
The email subject highlights the error
Node 2.1: Upload invoice to drive
This node uploads the original invoice file to Google D
It takes the uploaded file (`data0`) and saves it
model
W
When chat message received
Analyze image1
AI Agent1
Google Gemini Chat Model1
Get data
M
Make data in json struct…
C
check if Data exist or n…
Upload invoice to drive
no missing field - new d…
I
If - check missing field
Send missing field error…
Duplicate entry send mail
New data add using payload
Append data to sheet
Check Mandatory fields
Send successful email
16 nodes15 edges

How it Works

  1. 1

    Trigger

    The workflow starts with a trigger trigger.

  2. 2

    Process

    Data flows through 16 nodes, connecting agent, chattrigger, code.

  3. 3

    Output

    The workflow completes its automation and delivers the result to the configured destination.

Node Details (16)

GO

Google Sheets

googleSheets

#1
GO

Google Drive

googleDrive

#2
GM

Gmail

gmail

#3
CO

Code

code

#4
AI

AI Agent

n8n-nodes-langchain.agent

#5
GO

Google Gemini Chat Model

n8n-nodes-langchain.lmChatGoogleGemini

#6
GO

Google Gemini

n8n-nodes-langchain.googleGemini

#7

How to Import This Workflow

  1. 1Click Download JSON button on the right to save the workflow file.
  2. 2Open your n8n instance. Go to Workflows → New → Import from file.
  3. 3Select the downloaded extract-process-invoices-with-gemini-ai-google-sheets-gmail-notifications file and click Import.
  4. 4Set up credentials for each service node (API keys, OAuth, etc.).
  5. 5Click Test Workflow to verify everything works, then activate it.

Or paste directly in n8n → Import from JSON:

{ "name": "Extract & Process Invoices with Gemini AI, Google Sheets & Gmail Notifications", "nodes": [...], ...}

Integrations

agentchattriggercodegmailgoogledrivegooglegeminigooglesheetsiflmchatgooglegeminiset

Get This Workflow

Download and import in one click

Download JSONView on n8n.io
Nodes16
Complexityhigh
Triggertrigger

Created by

Yashraj singh sisodiya

Yashraj singh sisodiya

@theyashsisodiya

Tags

agentchattriggercodegmailgoogledrivegooglegeminigooglesheetsiflmchatgooglegeminiset

New to n8n?

n8n is a free, open-source workflow automation tool. Self-host it or use the cloud version.

Get n8n Free →

Related Invoice Processing Workflows

COCOEMEX+5
medium

Automate Custom QuickBooks Invoice PDFs & Email with n8n

Standard accounting templates often fail to reflect a premium brand identity. This sophisticated n8n workflow bridges the gap between financial record-keeping and professional client presentation. By moving beyond the native limitations of QuickBooks Online, this automation enables businesses to generate high-end, multi-page PDF invoices that align perfectly with their corporate styling. The process begins the moment a new invoice is generated in QuickBooks, triggering a webhook that captures real-time billing data. The workflow then utilizes advanced HTML-to-File conversion and custom Code nodes to structure data into a polished, branded layout. It handles complex logic such as line-item merging and multi-page formatting automatically. Once the document is rendered, the system bypasses generic 'no-reply' senders by routing the finalized PDF through your preferred email provider. This ensures a seamless, white-labeled experience for your clients while eliminating the manual overhead of exporting, styling, and attaching files. Ideal for agencies and service providers, this flow guarantees that your most frequent touchpoint—the bill—is as professional as your work. **Common Use Cases:** - High-end creative agencies requiring bespoke, white-labeled billing documents for premium clients. - Automated recurring subscription billing where custom tax disclosures or localized branding are required. - Service-based businesses needing to attach dynamic project reports or terms of service directly to QuickBooks invoices.

🔗 Webhook·12 nodes