n8n workflow template · 17 nodes · OpenAI
Invoice data extraction with LlamaParse and OpenAI is a free n8n workflow template that starts from the Gmail Trigger node and works with OpenAI, Gmail and Google Sheets. It has 17 nodes, 3 of them AI nodes (OpenAI Model, Structured Output Parser and Basic LLM Chain). The notes inside the workflow say: “Join the Discord or ask in the Forum!” To run it, you add your own credentials for Gmail OAuth2, Google Sheets OAuth2, HTTP Header Auth and OpenAI API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
This workflow does the following
Join the Discord or ask in the Forum!
Read more about Gmail Triggers
The Gmail node can watch for all incoming messages and filter based on a condition. We'll set our Gmail node to wait for
Read more about using HTTP Requests
LlamaIndex's LlamaCloud is a cloud-based service that allows you to upload, parse, and index document. LlamaParse is a tool offered by LlamaCloud to parse for complex PDFs with embedded objects ie PDF Tables and figures.
At time of writing, you can parse 1000 pdfs/day with LlamaCloud's free plan by signing up at
A common issue with PDF-to-text convertors are that they ignore important data structures like tables. These structures can be important for data extraction. For example, being able to distinguish between seperate line items in an invoice.
Read more about Basic LLM Chain
Large language models are perfect for data extraction tasks as they can work across a range of document layouts without human intervention. The extracted data can then be sent to a variety of datastores such as spreadsheets, accounting systems and/or CRMs.
Tip: The "Structured Output Parser" ensures the AI output can be inserted to our spreadsheet without additional clean up and/or formatting.
Need more attributes? Change it here!
Don't use GSheets? Swap this for Excel, Airtable or a Database!
Read more about working with Gmail
To finish off the workflow, we'll add the "invoice synced" label to the original invoice email to flag that the extraction was successful. This can be useful if working with a shared inbox and for quality control purposes later.
The 17 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us