See llms.txt for all machine-readable content.

Back to Templates

Split multi-invoice PDFs into invoices with Extend and Google Sheets

Quick overview

This workflow collects an uploaded multi-invoice PDF via an n8n form, uses Extend to split it into individual invoices and extract key invoice fields, then writes normalized invoice rows to Google Sheets while logging failures and “no invoice found” cases to a separate Errors sheet.

How it works

  1. Triggers when a user submits the n8n form with a PDF file upload.
  2. Uploads the PDF to the Extend Files API and sets extraction thresholds for OCR confidence, review score, and math tolerance.
  3. Starts an Extend split run to classify pages as invoice vs other and repeatedly polls Extend until the split run is PROCESSED or FAILED/CANCELLED.
  4. Turns the split results into one item per invoice split (or flags the file if no invoices are detected) and routes non-invoice/failed cases to error logging.
  5. For each invoice split, starts an Extend extract run using a predefined invoice schema and polls Extend until the extract run is PROCESSED or FAILED/CANCELLED.
  6. Builds a Google Sheets row from the extracted invoice data (including an auto-approved vs needs-review status) and appends or updates the row in the Invoices sheet.
  7. Normalizes any HTTP errors, failed runs, cancelled runs, or no-invoice results and appends a row to the Errors sheet in Google Sheets.

Setup

  1. Create an Extend API key (HTTP Bearer auth) and add it to the HTTP Request credentials used for the Extend endpoints.
  2. Create a Google Sheets OAuth2 connection and set the target spreadsheet URL/ID in both Google Sheets nodes.
  3. In your spreadsheet, create two tabs named Invoices and Errors with columns that match the fields being written (or let n8n create/match them), and adjust the OCR/review thresholds and math tolerance if needed.