Parse PDF Invoices with LlamaParse & Save to Airtable
Overview
This workflow automatically monitors a Google Drive folder for new invoice PDFs, sends them to LlamaParse for intelligent document parsing, extracts line items using OpenAI's structured output, and stores both the invoice header and individual line items in Airtable. It eliminates manual data entry by transforming unstructured invoice PDFs into structured database records.
The workflow is particularly useful for accounting teams, freelancers, and small businesses who receive invoices as PDFs and need to track expenses, line items, and vendor details in a structured format. By combining Google Drive's file monitoring, LlamaParse's document parsing, OpenAI's structured extraction, and Airtable's database capabilities, it creates an end-to-end invoice processing pipeline.
Node-by-Node Breakdown
-
Google Drive Trigger (OAuth2) — Monitors a specific Google Drive folder for newly created files. Configured to poll every minute and watch the "Invoices" folder (folder ID:
1IC39VXU8rewBU85offxYlBd9QlYzf8S7). When a new file is detected, it triggers the workflow. -
Google Drive (OAuth2) — Downloads the newly detected file from Google Drive using the file ID passed from the trigger node. The operation is set to "download" and retrieves the binary file data.
-
Upload File (Header Auth) — Sends the downloaded PDF to LlamaParse's API endpoint (
https://api.cloud.llamaindex.ai/api/parsing/upload) using a multipart form-data POST request. Includes:- The file as binary data
- A webhook URL for callback (
https://n8n.lowcoding.dev/webhook/0f7f5ebb-8b66-453b-a818-20cc3647c783) - Disables OCR and image extraction
- Parsing instructions to extract invoice line items (Name, Quantity, Unit Price, Amount)
- Authorization header (Bearer token — you must add your LlamaParse API key)
-
Webhook (No auth) — Receives the parsed result from LlamaParse via HTTP POST callback. This is the webhook URL specified in the upload step. It captures the structured JSON output containing parsed invoice data.
-
Set Fields (No auth) — Prepares the prompt and JSON schema for OpenAI. Sets two fields:
prompt: "Please, process parsed data and return only needed."schema: A strict JSON schema that defines the expected output structure (array of items with description, qty, unit_price, amount fields)
-
OpenAI - Extract Line Items (API Key auth via OpenAI credential) — Calls OpenAI's chat completions API (
https://api.openai.com/v1/chat/completions) with:- Model:
gpt-4o-mini - System message containing the prompt from Set Fields
- User message containing the parsed invoice data from the webhook
- Response format set to JSON schema for structured output
- Model:
-
Create Invoice (API Key auth via Airtable Personal Access Token) — Creates a new record in the Airtable "Invoices" table (base:
appndgSF4faN4jPXi, table:tbloPc7Eay4Cvwysq). The invoice record is created first to get its ID for linking line items. -
Process Line Items (No auth) — A JavaScript code node that:
- Extracts the
contentfield from OpenAI's response - Parses the JSON string to get the items array
- Splits each item into a separate output item for individual processing
- Extracts the
-
Create Line Item (API Key auth via Airtable Personal Access Token) — For each line item extracted, creates a record in the Airtable "Line Items" table (table:
tblIuVR9ocAomznzK) with:- Description, Qty, Unit price, Amount (parsed and cleaned)
- A link back to the parent invoice record using the invoice ID
Setup Instructions
Prerequisites
- Google Account with Google Drive access
- LlamaParse API Key from LlamaIndex Cloud
- OpenAI API Key from OpenAI Platform
- Airtable Account with a base containing two tables: "Invoices" and "Line Items"
Step-by-Step Setup
-
Google Drive Credentials: Create an OAuth2 credential in n8n for Google Drive. Grant access to the folder you want to monitor.
-
LlamaParse API Key: In the "Upload File" node, add your Bearer token in the Authorization header. Get your API key from LlamaIndex Cloud.
-
OpenAI Credential: Create an OpenAI API credential in n8n with your API key from OpenAI.
-
Airtable Credential: Create an Airtable Personal Access Token credential in n8n. Generate a token from Airtable's developer hub with scopes for
data.records:writeandschema.bases:read. -
Airtable Tables: Create two tables:
- Invoices: Contains invoice-level data (name, date, total, etc.)
- Line Items: Contains individual line items with fields: Description (text), Qty (number), Unit price (number), Amount (number), Invoices (linked record to Invoices table)
-
Google Drive Folder: Note the folder ID of your invoices folder and update it in the Google Drive Trigger node.
-
Webhook URL: The webhook URL in the LlamaParse upload must match the production URL of your n8n instance. Update it if needed.
Use Cases & Variations
Primary Use Case
- Automated Invoice Processing: Accounting teams can drop invoice PDFs into a Google Drive folder and have them automatically parsed and stored in Airtable without manual data entry.
Variations & Adaptations
- Different Document Types: Modify the parsing instructions to extract data from receipts, purchase orders, or contracts instead of invoices.
- Alternative Storage: Replace Airtable with Google Sheets, Notion, or a database like PostgreSQL for storing parsed data.
- Email Integration: Add an email trigger (Gmail, Outlook) to process invoices sent as email attachments.
- Approval Workflow: Add a Slack or email notification step to review parsed invoices before storing them.
- Multi-Format Support: Extend the workflow to handle images (JPG, PNG) by enabling OCR in the LlamaParse upload.
- Error Handling: Add error handling nodes to catch parsing failures and notify the user via email or Slack.
- Batch Processing: Modify the trigger to process multiple files at once or on a schedule rather than real-time.
Workflow JSON
{
"nodes": [
{
"id": "9df72ef9-3b9d-40e4-9cb5-a5ada153c0bb",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
120,
-180
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "wpiZXesxk9S8fkVG",
"name": "Google Drive account 2"
}
},
"typeVersion": 3
},
{
"id": "e21bb906-658c-4a52-9c7b-b77d6e0e7ea5",
"name": "Upload File",
"type": "n8n-nodes-base.httpRequest",
"position": [
360,
-180
],
"parameters": {
"url": "https://api.cloud.llamaindex.ai/api/parsing/upload",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "webhook_url",
"value": "https://n8n.lowcoding.dev/webhook/0f7f5ebb-8b66-453b-a818-20cc3647c783"
},
{
"name": "file",
// ... truncated (copy to see full JSON)How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
AI-Powered CV Scanner with Google Sheets & Gemini
Overview This workflow automates the initial screening of job applicants by combining a web form, AI-powered CV analysis, and Google Sheets. When a candidate submits their application (name, email, and CV PDF), the workflow instantly extracts the text from the PDF using Mistral OCR, then sends it to Google Gemini for evaluation against a predefined job description. The AI returns a qualification score (0.0 to 1.0) and a detailed explanation, which are then logged alongside the candidate's details in a Google Sheet. This eliminates manual CV review, speeds up your hiring pipeline, and ensures every applicant is evaluated consistently. Workflow Steps Application Form (Form Trigger) — No auth required. This node presents a custom-branded web form to collect the candidate's Full Name, Email, and CV (PDF upload). The form is styled with a dark, glassmorphism theme and includes animated backgrounds. Once submitted, the workflow triggers automatically. Log Candidate Submission (Google Sheets) — OAuth2. Immediately after form submission, this node appends the candidate's name and email to the 'CVs' Google Sheet. This ensures the application is recorded even if the subsequent analysis steps fail. Extract CV Text (Mistral AI) — API Key auth. This node takes the uploaded PDF file from the form and uses Mistral's OCR API to extract all text content from the CV. It dynamically selects the binary file uploaded in the previous step. AI Qualification (LLM Chain) — This is the core analysis node. It uses a detailed prompt that includes: - A system message defining the AI as a professional, objective hiring assistant. - The full job description for a "Senior Frontend Developer" with core requirements and preferred qualifications. - Clear evaluation logic: candidates missing core requirements cannot score above 0.6; meeting all core requirements yields at least 0.75; preferred qualifications add bonuses up to 1.0. - The extracted CV text as context. - An instruction to output raw JSON only. Gemini 2.5 Flash Lite (Language Model) — API Key auth (Google AI Studio). This node provides the actual AI model (Google Gemini 2.5 Flash Lite) with a temperature of 0.4 for balanced, deterministic outputs. It powers the LLM Chain above. JSON Output Parser (Output Parser) — This node ensures the AI's response is valid JSON with the exact schema: (number) and (string). It prevents malformed responses from breaking downstream nodes. Add CV Analysis (Google Sheets) — OAuth2. After analysis, this node updates the candidate's row in the 'CVs' sheet by matching on the Email column. It writes the and from the AI's output into the corresponding columns. Create 'CVs' Spreadsheet (Google Sheets) — OAuth2. This node runs once when the workflow is first triggered manually. It creates a new Google Sheet named 'CVs' with columns: FullName, Email, QualificationRate, QualificationDescription. Setup Instructions Prerequisites A Google account (for Google Sheets) A Mistral AI account (free tier available) — Get your API key here A Google AI Studio account — Create an API key here Step-by-Step Google Sheets Credentials: In the three Google Sheets nodes, create or select an OAuth2 credential for Google Sheets. Grant access to create and edit spreadsheets. Mistral AI Credential: In the "Extract CV Text" node, create a new credential and paste your Mistral API key. Gemini Credential: In the "Gemini 2.5 Flash Lite" node, create a new credential and paste your Google AI Studio API key. Customize Job Description: Open the "AI Qualification" node and edit the section in the prompt to match your actual job posting. Activate the Workflow: Toggle the workflow to "Active" status. The "Application Form" node will generate a public URL you can share with candidates. Test: Use the "Start Here" manual trigger to initialize the Google Sheet, then submit a test application via the form URL. Use Cases & Variations Custom Job Roles: Replace the Senior Frontend Developer description with any role (e.g., Marketing Manager, Data Scientist, Sales Rep) by editing the prompt in the AI Qualification node. Different Storage: Replace Google Sheets with Airtable, Notion, or a database like PostgreSQL for storing applications and results. Multi-Round Screening: Add a Slack or email notification node to alert the hiring team when a candidate scores above a certain threshold (e.g., >0.8). Interview Scheduling: Connect the output to a Calendly or Google Calendar node to automatically invite high-scoring candidates for an interview. Batch Processing: Modify the trigger to accept a CSV upload of multiple CVs for bulk analysis. Enhanced Analysis: Add more output fields like "years of experience", "top skills", or "red flags" by updating the JSON schema in the Output Parser and the prompt.
Talk to Your Google Sheets Data Using OpenAI Chat Agent
This workflow transforms a Google Sheet into a live, conversational database. Using an AI agent powered by OpenAI's GPT-4.1-nano model, you can ask natural language questions about your spreadsheet data and receive accurate, context-aware answers — without writing any SQL or formulas. The agent can handle queries like total campaign spend, per-channel breakdowns, month-over-month trends, and cost-per-lead calculations. Workflow Steps Node-by-Node Breakdown Chat with Your Data (Chat Trigger) — This is the entry point of the workflow. It provides a chat interface (webhook) where users type their questions. No authentication is required to trigger the webhook; access can be secured at the workflow level. Memory (Buffer Window Memory) — Stores recent conversation history so the AI can reference previous exchanges. The buffer window keeps the last few messages to maintain context without excessive token use. No authentication required. OpenAI Chat Model (OpenAI GPT-4.1-nano) — The language model that processes user questions and generates answers. Uses API Key auth (you must provide an OpenAI API key). Parameters: model = , no additional options configured. Talk to Your Data (AI Agent) — The core agent that orchestrates the conversation. It receives user input, decides which tool to call (only the Google Sheets tool is available), and returns answers. Uses API Key auth (uses the same OpenAI credential as the model). Parameters include a system message: "Google Sheets Ask-… You are Ask-… Answer questions using Google Sheets ONLY via the tool below. Be precise and conservative. There is only one dataset. Don't ask what dataset it is. Use the data tool to answer the question." Analyze Data (Google Sheets Tool) — The tool the agent calls to read spreadsheet data. Uses OAuth2 authentication (Google Sheets). Parameters: document ID = ("Sample Marketing Data - n8n"), sheet name = "Data" (gid: 365710158). No additional options set. Sticky Notes (Information Only) — Provide setup instructions and tips. Not executable nodes. Setup Instructions Before using this workflow, you need: OpenAI Account — Visit OpenAI API Keys to generate an API key. Make sure you have billing set up at OpenAI Billing and have credits available. Google Account — You need access to a Google Sheet. The sample uses a specific sheet, but you can point it to any sheet with a similar structure: first row = column headers, rows 2–100 = data. To configure: In the OpenAI Chat Model node, create an OpenAI credential with your API key. In the Analyze Data node, create a Google Sheets OAuth2 credential (select your Google account and authorize access). Update the Document ID and Sheet Name to match your own Google Sheet. Optionally update the system message in the Talk to Your Data agent if you want to change the assistant's personality or instructions. Use Cases and Variations This workflow is perfect for: Marketing teams wanting instant answers about campaign performance, spend, and ROI. Sales operations analyzing pipeline data, deal stages, or conversion metrics. Small business owners asking questions about inventory, sales, or customer data without learning SQL. Adaptations: Replace Google Sheets with another data source tool (e.g., Airtable, Notion, PostgreSQL, MySQL) by swapping the "Analyze Data" node. Add more tools to the agent (e.g., a web search tool, a calculator) to expand its capabilities. Change the model to GPT-4o or GPT-3.5-turbo for faster/cheaper responses. Add a Slack or Webhook trigger instead of the chat trigger for a different user interface.
Extract company website metadata via Apify Company Enrichment
This workflow takes a single company domain (e.g., ), validates it, runs it through Apify's Company Enrichment actor, and returns a verified metadata result with provenance. It is designed as a building block for CRM enrichment, lead generation, or data quality pipelines. Workflow Steps Run manually (Manual Trigger) – Starts the workflow on demand. No schedule is set; you can extend it with a cron trigger. Set company domain (Set node) – Hardcodes the domain into a field . Change this to your target domain. Validate domain (Code node, JavaScript) – Validates the domain format (length, allowed characters, no protocol or path). Throws an error if invalid. Also attaches an marker for downstream validation. Extract metadata on Apify (HTTP Request, Header Auth) – Sends a POST request to the Apify actor's sync endpoint with the domain payload. Uses Header Auth with a custom header . Parameters: , to cap cost. Timeout 150 seconds. Validate metadata result (Code node, JavaScript) – Checks the response: only one item, , domain matches, integration source matches, and provenance method is . Rejects any unexpected or empty results. Setup Instructions Get an Apify API token – Sign up or log in at apify.com. Create a token scoped to run actors (). Create an n8n Header Auth credential – In n8n, go to Credentials > New > Header Auth. Set the header name to and value to . Attach this credential to the Extract metadata on Apify node. Replace the default domain – In the Set company domain node, change to your target company domain (e.g., ). Review pricing – The actor charges per run. The workflow caps cost at $0.02 USD per call. Review actor pricing before scaling. Run manually – Click Execute Workflow to test. The output will be a single enriched company object. Use Cases & Adaptations CRM integration – Pipe the output into Salesforce or HubSpot via an HTTP Request or their respective n8n nodes. Bulk enrichment – Replace the manual trigger with a Schedule Trigger or a Spreadsheet File Trigger to process thousands of domains from a Google sheet or CSV. Data validation – Use the validated result to enrich lead lists, verify company websites, or update a database. Custom enrichment – Replace the Apify actor with another REST API (e.g, Clearbit, Zoominfo) by modifying the HTTP Request node and validation logic.