Skip to main content

Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets

Workflow preview

Workflow preview
100%
Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template demonstrates how to automate invoice data extraction from PDF attachments received via Gmail. Using LlamaParse and Gemini LLM, this workflow parses structured fields like PO numbe...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.httprequest, n8n-nodes-base.stickynote, n8n-nodes-base.gmailtrigger, n8n-nodes-base.googlesheets, n8n-nodes-base.wait, n8n-nodes-base.switch, n8n-nodes-base.gmail

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets
Workflow name
Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets

This n8n template demonstrates how to automate invoice data extraction from PDF attachments received via Gmail. Using LlamaParse and Gemini LLM, this workflow parses structured fields like PO numbers, line items, tax amounts, and totals — and stores them neatly into a Google Sheet.

Perfect for use cases such as: 💼 Finance teams managing vendor invoices 📊 Bookkeeping workflows 🔄 Automating monthly reconciliation

Good to Know

At the time of writing, LlamaParse and Gemini may involve API usage costs depending on your subscription tier. Check LlamaIndex Pricing and Gemini Pricing for updated info.

LlamaParse provides Markdown-formatted parsed output which is then passed to an LLM for structured field extraction.

Gemini models may be geo-restricted. If you encounter "model not found" errors, your region might not be supported.

How it Works

  • Trigger: Watches your Gmail for new emails with PDF attachments.
  • Email Filter: Ensures we only parse fresh emails not already labeled as "invoice synced".
  • LlamaParse Upload: Uploads the PDF to LlamaParse’s parsing endpoint.
  • Status Polling: Periodically checks whether the parsing is complete.
  • Download Markdown: Once ready, it fetches the parsed invoice in Markdown format.
  • AI Parsing with Gemini: Sends the Markdown to Gemini LLM to extract structured JSON (like PO number, line items, taxes, etc.) using a predefined schema.
  • Google Sheets Upload: Stores extracted data into a predefined spreadsheet.
  • Labeling: Marks the email as “invoice synced” to avoid reprocessing.

How to Use

The trigger is based on Gmail, but you can replace this with a webhook or manual trigger for testing.

Setup Instructions

Gmail API

  • Enable Gmail API in Google Cloud Console.
  • Connect your Gmail account in n8n credentials.
  • Allow read + modify access.

Google Sheets

  • Create a new Google Sheet with the following headers (row 1): Date | Vendor Name | Invoice Number | PO Number | Line Items | Subtotal | Tax | Total Amount
  • Connect Google Sheets in n8n and paste the Sheet ID in the node.
  • You can customise the google sheet basis your requirement.

LlamaParse

  • Get a LlamaIndex API Key from LlamaIndex.
  • Use the LlamaParse upload and polling nodes to process your PDFs.

Gemini (via Vertex AI)

  • Set up Gemini access in GCP.
  • Use the Gemini 2.5 Model.
  • Construct a structured prompt to extract required fields.

Labeling

  • Create a Gmail label named "Invoice Synced" for tracking processed emails.

Requirements

Gmail account with API access

LlamaParse (LlamaIndex) account with API Key

Google Sheets API credentials

Access to Gemini 2.5 model via Google Vertex AI

Customising This Workflow

This template is just the beginning. You can expand it to:

  • Auto-generate invoices back to vendors
  • Run duplicate checks before inserting into Sheets
  • Integrate with accounting tools like Zoho, QuickBooks, or Tally
  • Trigger Slack/Email notifications on specific vendors or high invoice amounts

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 - Structured Output Parser

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

Block 2 - Upload to LlamaParse

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

Block 3 - Sticky Note

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

Block 4 - Receiving Invoices

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

Block 5 - Append to Reconciliation Sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.3

Block 6 - Get Processing Status

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

Block 7 - Wait to stay within service limits

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 8 - Is Job Ready?

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

Block 9 - Sticky Note1

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

Block 10 - Sticky Note2

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

Block 11 - Sticky Note4

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

Block 12 - Sticky Note5

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

Block 13 - Add "invoice synced" Label

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

Block 14 - Get Parsed Invoice Data

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

Block 15 - Map Output

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

Block 16 - Apply Data Extraction Rules

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.4

Block 17 - Should Process Email?

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

Block 18 - Split Out Labels

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

Block 19 - Get Labels Names

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

Block 20 - Combine Label Names

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

Block 21 - Email with Label Names

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

Block 22 - Sticky Note6

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

Block 23 - Sticky Note7

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

Block 24 - Sticky Note8

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 Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets
Complexity advanced
Nodes 25
Categories Invoice Processing, AI Summarization
Author Agentick AI
Published 07 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5739/5739.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 Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets do?

This n8n template demonstrates how to automate invoice data extraction from PDF attachments received via Gmail. Using LlamaParse and Gemini LLM, this workflow parses structured fields like PO numbe...

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.