This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.
Invoice Data Extraction with PDF Agile and n8n: Push to Your CRM in 20 Minutes
If your team still copies invoice data by hand into a CRM or spreadsheet, you are spending real hours on a task that a small automation can handle in seconds. This guide walks you through a practical workflow that uses PDF Agile for OCR and PDF processing, and n8n — open-source workflow automation with 400+ integrations, available to self-host for free or run on n8n Cloud — to route extracted data straight into your CRM of choice.
The setup takes roughly 20 minutes. No code is required beyond a few JSON expressions inside n8n.
What You Will Build
The finished workflow does the following automatically:
- Watches a folder or email inbox for new PDF invoices
- Sends the PDF to PDF Agile for OCR text extraction
- Parses key fields: invoice number, date, vendor name, line items and total amount
- Creates or updates a record in your CRM (HubSpot, Pipedrive, Capsule, Zoho — any CRM with an API)
- Optionally sends a Slack or email notification when a new invoice lands
What You Need Before You Start
- PDF Agile installed or access to its API — the all-in-one PDF tool covers editing, conversion, compression, OCR and signing. You can get it from PDF Agile to handle the OCR side of this workflow.
- An n8n instance (self-hosted or n8n Cloud)
- API credentials for your CRM
- A folder on Google Drive, a local path, or an IMAP email account to watch for incoming invoices
Step 1 — Trigger: Watch for New Invoices
Open n8n and create a new workflow. Add a trigger node. The most common choices are:
- Google Drive Trigger — fires when a new file appears in a specific folder
- IMAP Email node — polls a mailbox and picks up attachments
- Webhook node — if another system pushes a file path to n8n
For this example, use the Google Drive Trigger set to watch a folder called Invoices Incoming. Set the poll interval to every 5 minutes.
Step 2 — Download the PDF
Add a Google Drive node in Download File mode. Map the file ID from the trigger output. The node returns the binary PDF content that the next step will process.
Step 3 — Extract Text with PDF Agile OCR
This is where PDF Agile does the heavy lifting. PDF Agile converts scanned or native PDFs into structured, machine-readable text using its built-in OCR engine.
In n8n, add an HTTP Request node and configure it to call the PDF Agile API endpoint:
- Method: POST
- URL: your PDF Agile OCR endpoint
- Body: Binary — attach the PDF from the previous node
- Headers: include your API key
The response returns the full text of the invoice as a string. For well-formatted PDFs, PDF Agile can also return structured JSON with field positions, which makes parsing even easier.
Step 4 — Parse Invoice Fields
Add a Code node (JavaScript) or use n8n's built-in Set node with expressions. Extract the fields you need:
- Invoice number — regex:
/Invoice\s*#?\s*(\w+)/i - Invoice date — regex for common date formats
- Vendor name — usually the first proper noun block at the top of the document
- Total amount — regex:
/Total[:\s]+\$?([\d,\.]+)/i
If your invoices follow a consistent template, the regex approach works reliably. For highly variable invoice formats, consider adding an AI Text Classifier node or an OpenAI node to interpret the raw text before mapping fields.
Example Code Node Snippet
const text = $input.item.json.extractedText;
const invoiceNumber = text.match(/Invoice\s*#?\s*(\w+)/i)?.[1] ?? '';
const total = text.match(/Total[:\s]+\$?([\d,\.]+)/i)?.[1] ?? '';
return [{ json: { invoiceNumber, total } }];
Step 5 — Push Data to Your CRM
Add the node for your CRM. n8n includes native nodes for HubSpot, Pipedrive, Zoho CRM, Salesforce and many others. Set the node to Create or Update a deal or contact record and map the parsed fields:
- Deal name ← vendor name
- Amount ← total amount
- Custom field: Invoice Number ← invoice number
- Close date ← invoice date
Use the Upsert option where available so that re-processing the same invoice does not create duplicate records.
Step 6 — Notify Your Team
Add a Slack node or Send Email node at the end of the workflow. A simple message like "New invoice from [vendor] for [amount] added to CRM" keeps your finance team informed without any manual checking.
Step 7 — Activate and Test
- Drop a sample invoice PDF into your watched Google Drive folder
- Wait for the trigger to fire (or click Execute Workflow for an instant test)
- Check the n8n execution log for each node's output
- Verify the new record in your CRM
- Activate the workflow toggle — it now runs automatically
Tips for Reliable Extraction
- Normalise file names before processing to avoid duplicate runs
- Add an error branch in n8n so failed extractions route to a Slack alert rather than silently failing
- Log raw OCR output to a Google Sheet for auditing during the first few weeks
- Test with 10–15 real invoices from different vendors before going live
What This Workflow Replaces
A typical small business receives 50–200 invoices per month. At 3–5 minutes of manual data entry each, that is between 2.5 and 16 hours of repetitive work per month. This automation brings that figure close to zero while reducing transcription errors that lead to payment disputes or audit headaches.
Extending the Workflow
Once the base workflow is running, common extensions include:
- Routing invoices above a threshold to a manager approval step
- Connecting to accounting software (Xero, QuickBooks) via their API nodes
- Storing the original PDF in a tagged folder structure in Google Drive or Dropbox
- Generating a weekly summary report from all processed invoices
If you receive invoices by email or in a shared folder and want to stop entering data by hand, you can build this exact workflow via n8n — including open-source workflow automation with 400+ integrations, free to self-host or available on n8n Cloud — to have invoice data flowing into your CRM automatically within 20 minutes.