Classify documents and extract invoice data with LDXhub AnalyzeDoc and Google Sheets

Go to Workflow
2 views
Built by Hideki Mori Hideki Mori
Created on July 28, 2026

Description

Quick overview
This workflow collects uploaded PDFs or images, classifies each document type using LDXhub AnalyzeDoc, and routes it accordingly; invoices get high-detail field extraction and are appended as a new row in Google Sheets.

How it works
Receives a file upload through an n8n form for a PDF, JPG, or PNG business document.
Sends the file to LDXhub AnalyzeDoc (low-detail) to classify it as invoice, receipt, business_card, contract, blank, or other.
Parses the returned JSON and routes the execution based on the detected document_type.
For invoices, reattaches the original uploaded file and runs LDXhub AnalyzeDoc (high-detail) to extract key invoice fields in structured JSON.
Flattens the extracted fields and appends them as a new row in a selected Google Sheets worksheet.
For receipts, business cards, and other types, sends the item to placeholder routes where you can add your own processing.

Setup
Create an LDXhub account, generate an API key, and configure an LDXhub API credential in n8n for both AnalyzeDoc steps.
Connect a Google Sheets OAuth2 credential and select the target spreadsheet and worksheet in the append step.
Ensure the first row of your sheet contains headers matching the extracted invoice fields (invoice_number, issue_date, due_date, vendor_name, vendor_address, vendor_tax_id, bill_to, subtotal, tax, total, currency, payment_terms).

Additional info
The receipt, business card, and other branches are intentional extension points (No-Op placeholders) — the invoice branch is the complete, ready-to-run path. Add your own processing to the other branches as needed.

Nodes Used (2)

Code
n8n-nodes-base.code
Google Sheets
n8n-nodes-base.googleSheets