Invoice Data Extraction with PDF Agile and n8n – 20 Min Setup

Rechnungsdaten automatisch extrahieren mit PDF Agile und n8n

🇬🇧 English

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

  1. Drop a sample invoice PDF into your watched Google Drive folder
  2. Wait for the trigger to fire (or click Execute Workflow for an instant test)
  3. Check the n8n execution log for each node's output
  4. Verify the new record in your CRM
  5. 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.

🇩🇪 Deutsch

Dieser Artikel enthält Affiliate-Links (Werbung). Kaufst du darüber, erhalten wir ggf. eine Provision – für dich ohne Mehrkosten.

Rechnungsdaten automatisch extrahieren und ins CRM übertragen – mit PDF Agile und n8n

Wer Rechnungsdaten noch manuell aus PDFs abtippen und ins CRM eintragen lässt, verschwendet wertvolle Arbeitszeit. Mit einer kleinen Automatisierung lässt sich dieser Prozess vollständig delegieren. Dieser Artikel zeigt Schritt für Schritt, wie du n8n — Open-Source-Workflow-Automatisierung mit über 400 Integrationen, kostenlos selbst hostbar oder als n8n Cloud verfügbar — mit PDF Agile kombinierst, um Rechnungsdaten automatisch zu extrahieren und direkt ins CRM zu übertragen.

Der Aufwand: etwa 20 Minuten. Programmierkenntnisse sind nicht erforderlich.

Was du am Ende hast

Der fertige Workflow erledigt folgende Schritte automatisch:

  • Überwacht einen Ordner oder ein E-Mail-Postfach auf neue Rechnungs-PDFs
  • Sendet das PDF an PDF Agile zur OCR-Texterkennung
  • Extrahiert Felder wie Rechnungsnummer, Datum, Lieferant, Positionen und Gesamtbetrag
  • Legt im CRM einen neuen Datensatz an oder aktualisiert einen bestehenden
  • Sendet optional eine Slack- oder E-Mail-Benachrichtigung an dein Team

Voraussetzungen

  • PDF Agile — das All-in-One-PDF-Tool mit OCR, Bearbeitung, Konvertierung, Komprimierung und Signatur. Du bekommst es über PDF Agile und nutzt es hier für die Texterkennung.
  • Eine n8n-Instanz (selbst gehostet oder n8n Cloud)
  • API-Zugangsdaten für dein CRM (HubSpot, Pipedrive, Zoho, Capsule o. ä.)
  • Einen Google-Drive-Ordner, ein lokales Verzeichnis oder ein IMAP-Postfach als Eingangsquelle

Schritt 1 — Trigger: Auf neue Rechnungen warten

Öffne n8n und erstelle einen neuen Workflow. Als Trigger-Node stehen dir folgende Optionen zur Verfügung:

  • Google Drive Trigger — reagiert, wenn eine neue Datei in einem bestimmten Ordner erscheint
  • IMAP Email Node — prüft ein Postfach regelmäßig auf neue Anhänge
  • Webhook Node — wenn ein anderes System den Dateipfad aktiv an n8n übermittelt

Im Beispiel verwenden wir den Google Drive Trigger für einen Ordner namens Eingehende Rechnungen. Intervall: alle 5 Minuten.

Schritt 2 — PDF herunterladen

Füge einen Google Drive Node im Modus Datei herunterladen hinzu. Mappe die Datei-ID aus dem Trigger-Output. Der Node gibt den binären PDF-Inhalt zurück, den der nächste Schritt verarbeitet.

Schritt 3 — Texterkennung mit PDF Agile OCR

Hier übernimmt PDF Agile die Hauptarbeit. Die OCR-Engine wandelt gescannte oder native PDFs in maschinenlesbaren Text um — auch bei komplexen Layouts und mehrsprachigen Dokumenten.

Füge in n8n einen HTTP-Request-Node hinzu und konfiguriere ihn so:

  • Methode: POST
  • URL: dein PDF Agile OCR-Endpunkt
  • Body: Binary — das PDF aus dem vorherigen Node anhängen
  • Header: API-Schlüssel eintragen

Die Antwort enthält den vollständigen Rechnungstext als String. Bei gut strukturierten PDFs liefert PDF Agile auch strukturiertes JSON mit Feldpositionen zurück, was das Parsen deutlich vereinfacht.

Schritt 4 — Rechnungsfelder extrahieren

Füge einen Code-Node (JavaScript) oder den Set-Node mit Ausdrücken hinzu. Extrahiere die relevanten Felder:

  • Rechnungsnummer — Regex: /Rechnungs-?Nr\.?\s*:?\s*(\w+)/i
  • Rechnungsdatum — Regex für gängige Datumsformate
  • Lieferantenname — in der Regel der erste Namensblock am Anfang des Dokuments
  • Gesamtbetrag — Regex: /Gesamt(?:betrag)?[:\s]+(\d[\d.,]+)/i

Bei einheitlichen Rechnungsformaten ist der Regex-Ansatz zuverlässig. Bei stark variierenden Layouts empfiehlt sich ein zusätzlicher OpenAI-Node, der den Rohtext interpretiert, bevor die Felder gemappt werden.

Beispiel: Code-Node-Snippet


const text = $input.item.json.extractedText;
const rechnungsNr = text.match(/Rechnungs-?Nr\.?\s*:?\s*(\w+)/i)?.[1] ?? '';
const gesamt = text.match(/Gesamt(?:betrag)?[:\s]+(\d[\d.,]+)/i)?.[1] ?? '';
return [{ json: { rechnungsNr, gesamt } }];

Schritt 5 — Daten ins CRM übertragen

Füge den passenden CRM-Node hinzu. n8n bietet native Nodes für HubSpot, Pipedrive, Zoho CRM, Salesforce und viele weitere. Setze den Modus auf Erstellen oder Aktualisieren und mappe die extrahierten Felder:

  • Deal-Name ← Lieferantenname
  • Betrag ← Gesamtbetrag
  • Benutzerdefiniertes Feld: Rechnungsnummer ← extrahierte Nummer
  • Datum ← Rechnungsdatum

Nutze die Upsert-Option, wo verfügbar, damit eine erneute Verarbeitung derselben Rechnung keinen Duplikateintrag erzeugt.

Schritt 6 — Team benachrichtigen

Füge am Ende einen Slack-Node oder E-Mail-Node hinzu. Eine kurze Meldung wie „Neue Rechnung von [Lieferant] über [Betrag] im CRM erfasst" hält dein Buchhaltungsteam auf dem Laufenden, ohne dass jemand manuell nachschauen muss.

Schritt 7 — Aktivieren und testen

  1. Lege eine Muster-Rechnung als PDF in den überwachten Google-Drive-Ordner
  2. Warte auf den Trigger oder klicke auf Workflow ausführen für einen Soforttest
  3. Prüfe das Ausführungsprotokoll in n8n für jeden Node
  4. Kontrolliere den neuen Datensatz in deinem CRM
  5. Aktiviere den Workflow-Schalter — ab jetzt läuft alles automatisch

Tipps für eine zuverlässige Extraktion

  • Dateinamen normalisieren vor der Verarbeitung, um doppelte Durchläufe zu vermeiden
  • Fehler-Branch einrichten in n8n, damit gescheiterte Extraktionen als Slack-Alarm landen statt still zu versagen
  • Rohen OCR-Output loggen in einem Google Sheet zur Überprüfung in den ersten Wochen
  • Mit 10–15 echten Rechnungen von verschiedenen Lieferanten testen, bevor der Workflow live geht

Was dieser Workflow ersetzt

Ein typisches kleines Unternehmen erhält 50–200 Rechnungen pro Monat. Bei 3–5 Minuten manueller Dateneingabe pro Rechnung sind das bis zu 16 Stunden repetitive Arbeit im Monat — Arbeit, die dieser Workflow auf nahezu null reduziert und gleichzeitig Tippfehler eliminiert, die zu Zahlungsstreitigkeiten oder Problemen bei der Prüfung führen können.

Workflow erweitern

Sobald der Basis-Workflow läuft, bieten sich folgende Erweiterungen an:

  • Rechnungen über einem bestimmten Betrag an eine Freigabestufe weiterleiten
  • Buchhaltungssoftware anbinden (Lexoffice, DATEV, Xero) über deren API-Nodes
  • Original-PDFs in einer strukturierten Ordnerstruktur in Google Drive oder Dropbox ablegen
  • Wöchentlichen Zusammenfassungsbericht aus allen verarbeiteten Rechnungen erstellen

Wenn du Rechnungen per E-Mail oder in einem geteilten Ordner erhältst und die manuelle Dateneingabe endlich beenden möchtest, kannst du über n8n diesen Workflow aufbauen — inklusive Open-Source-Workflow-Automatisierung mit über 400 Integrationen, kostenlos selbst hostbar oder als n8n Cloud — und Rechnungsdaten in unter 20 Minuten automatisch ins CRM übertragen.