Skip to main content

Invoice data extraction with LlamaParse and OpenAI

Workflow preview

Workflow preview
100%
Invoice data extraction with LlamaParse and OpenAI 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 workflow automates the process of parsing and extracting data from PDF invoices. With this workflow, accounts and finance people can realise huge time and cost savings in their busy schedu...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.lmopenai, @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

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Invoice data extraction with LlamaParse and OpenAI
Workflow name
Invoice data extraction with LlamaParse and OpenAI

This n8n workflow automates the process of parsing and extracting data from PDF invoices. With this workflow, accounts and finance people can realise huge time and cost savings in their busy schedules.

Read the Blog: https://blog.n8n.io/how-to-extract-data-from-pdf-to-excel-spreadsheet-advance-parsing-with-n8n-io-and-llamaparse/

How it works

  • This workflow will watch an email inbox for incoming invoices from suppliers
  • It will download the attached PDFs and processing them through a third party service called LlamaParse.
  • LlamaParse is specifically designed to handle and convert complex PDF data structures such as tables to markdown.
  • Markdown is easily to process for LLM models and so the data extraction by our AI agent is more accurate and reliable.
  • The workflow exports the extracted data from the AI agent to Google Sheets once the job complete.

Requirements

  • The criteria of the email trigger must be configured to capture emails with attachments.
  • The gmail label "invoice synced" must be created before using this workflow.
  • A LlamaIndex.ai account to use the LlamaParse service.
  • An OpenAI account to use GPT for AI work.
  • Google Sheets to save the output of the data extraction process although this can be replaced for whatever your needs.

Customizing this workflow

This workflow uses Gmail and Google Sheets but these can easily be swapped out for equivalent services such as Outlook and Excel.

Not using Excel? Simple redirect the output of the AI agent to your accounting software of choice.

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 Model

Type / Role
@n8n/n8n-nodes-langchain.lmOpenAi - lmOpenAi
Config choices
Version 1

Block 2 - Structured Output Parser

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

Block 3 - Upload to LlamaParse

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

Block 4 - Sticky Note

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

Block 5 - Receiving Invoices

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

Block 6 - Append to Reconciliation Sheet

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

Block 7 - Get Processing Status

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

Block 8 - Wait to stay within service limits

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

Block 9 - Is Job Ready?

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

Block 10 - Sticky Note1

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

Block 11 - Sticky Note2

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

Block 12 - Sticky Note3

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

Block 13 - Sticky Note4

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

Block 14 - Sticky Note5

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

Block 15 - Add "invoice synced" Label

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

Block 16 - Get Parsed Invoice Data

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

Block 17 - Map Output

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

Block 18 - Apply Data Extraction Rules

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

Block 19 - Should Process Email?

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

Block 20 - Split Out Labels

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

Block 21 - Get Labels Names

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

Block 22 - Combine Label Names

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

Block 23 - Email with Label Names

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

Block 24 - Sticky Note6

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

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

3. Summary Table

Workflow Invoice data extraction with LlamaParse and OpenAI
Complexity advanced
Nodes 26
Categories Invoice Processing, AI Summarization
Author Jimleuk
Published 09 Jul 2024

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2320/2320.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 Invoice data extraction with LlamaParse and OpenAI do?

This n8n workflow automates the process of parsing and extracting data from PDF invoices. With this workflow, accounts and finance people can realise huge time and cost savings in their busy schedu...

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.