FREE N8N TEMPLATE · FINANCE & ADMIN

This n8n workflow watches a Gmail label for supplier invoices, reads the text of each PDF, and uses an AI model to pull out the supplier, ABN, invoice number, dates, GST and line items. It checks the ABN and the totals, then creates a draft bill in Xero. Anything that fails a check, or comes from a supplier not yet in Xero, goes to a review tab and a Slack message instead. Nothing is approved or paid automatically.

DIFFICULTY
Intermediate
SET-UP TIME
About 60 minutes
NODES
14
CHECKED AGAINST
n8n 2.41
  • Gmail
  • Xero
  • OpenAI or Anthropic
  • Google Sheets
  • Slack

LAST REVIEWED OCTOBER 2026

invoice-ocr-to-xero.n8n.jsonLOCKED

Get the free workflow

Leave your email to copy the workflow and paste it straight onto your n8n canvas.

FREE · NO CREDENTIALS INCLUDED · CLOUD OR SELF-HOSTED

001 / HOW IT WORKS

Step by step, node by node

  1. 01Watch the invoices label in Gmail

    The Gmail trigger polls for new emails with a PDF attachment under a label such as supplier-invoices, and downloads the attachments so the workflow can read them.

  2. 02Split out each PDF attachment

    A Code node creates one item per PDF and keeps the sender, subject, received date and file name alongside it, so emails with several invoices are handled one invoice at a time.

  3. 03Read the PDF text

    The Extract from File node pulls the text layer out of each PDF. Most invoices generated by accounting software have one. Scanned images with no text are caught later by the confidence check.

  4. 04Extract the invoice fields with AI

    The Information Extractor node sends the text to your chat model with a fixed schema: supplier name, ABN, invoice number, invoice and due dates, currency, amount excluding GST, GST, total, line items and a confidence rating.

  5. 05Check the extraction

    A Code node validates the ABN with the official checksum, confirms the subtotal plus GST equals the total, flags GST that looks too high, foreign currency, credit notes, missing fields and anything the model was not confident about.

  6. 06Route clean invoices to Xero, others to review

    An If node sends invoices that passed every check to Xero. Everything else goes straight to the review queue with the list of reasons attached.

  7. 07Find the supplier contact in Xero

    The Xero node searches your contacts by name. If no match is found, the invoice is flagged as a new supplier and sent to review rather than creating a contact automatically.

  8. 08Create a draft bill in Xero

    For a known supplier, the Xero node creates a bill with status Draft, the supplier invoice number, dates, the amount excluding GST and the GST amount on your default expense account. It stays in Draft until someone approves it.

  9. 09Log to the invoice register

    Each draft bill is appended to a Google Sheet with the supplier, ABN, amounts, file name and Xero bill ID, giving you a simple register to reconcile against Xero.

  10. 10Ask a person to review exceptions

    Invoices that failed a check or have a new supplier are written to a Needs review tab, and a Slack message tells the bookkeeper what came in and why it needs a human look.

SUPPLIER INVOICE EMAIL TO XERO DRAFT BILL WITH AI EXTRACTION
@New SupplierInvoice Email{}Split PDFAttachments▭Read PDF Text✦Extract InvoiceFields◆Chat Model{}Check Extraction⑂Passed Checks?XFind Supplier inXero⑂Supplier Found?XCreate Draft Billin Xero▦Log to InvoiceRegister≡Flag New Supplier▦Log to ReviewQueue#Ask Bookkeeper toReview

THE REAL WORKFLOW YOU IMPORT · NODE NAMES AS THEY APPEAR IN N8N

002 / WHY IT EXISTS

Keying supplier invoices into Xero is slow, repetitive work. Someone opens each email, downloads the PDF, finds the supplier in Xero, types the invoice number, dates, amounts and GST, and hopes nothing was mistyped. In a busy month that is hours of data entry, and a single transposed digit in a total or a missed GST amount can throw out the BAS.

This template suits small businesses, bookkeepers and practices that receive most bills as PDF attachments. It does the reading and typing, then stops at a draft so the person who approves bills still sees every one in Xero. It is a starting point you can adapt, not a replacement for your approval process or for a review of the GST coding.

WHO IT'S FOR

  • →Small business owners who enter their own supplier bills into Xero
  • →Bookkeepers managing accounts payable for several clients
  • →Finance or admin staff who receive invoices at a shared accounts inbox
  • →Practices that want a first draft in Xero but keep a person approving every bill

003 / WHAT YOU NEED

Tick them off as you go. Nothing is saved; it's just a checklist.

004 / SET IT UP

  1. 01

    Import the workflow JSON into n8n and open the Setup Notes sticky note.

  2. 02

    In Gmail, create a label such as supplier-invoices and a filter that applies it to invoice emails. Match the label in the trigger's search query and set a polling interval.

  3. 03

    Create a Xero OAuth2 credential in n8n, then select your organisation in the Find Supplier in Xero and Create Draft Bill in Xero nodes.

  4. 04

    Replace YOUR_EXPENSE_ACCOUNT_CODE with the account code bills should default to, such as your general expenses account. The bookkeeper can recode lines in Xero before approving.

  5. 05

    Create the Google Sheet with Invoice register and Needs review tabs, add the column headers used in the two Sheets nodes, and paste the sheet ID.

  6. 06

    Add your OpenAI credential to the Chat Model node, or replace it with an Anthropic Chat Model connected to Extract Invoice Fields.

  7. 07

    Choose the Slack channel in Ask Bookkeeper to Review.

  8. 08

    Send yourself a few real supplier invoices, run the workflow manually and compare every draft bill against the PDF before activating it.

Get the workflow↑

005 / MAKE IT YOURS

  • +Attach the original PDF to the draft bill using an HTTP Request node and Xero's Attachments endpoint, so approvers see the source document in Xero.
  • +Write one bill line per extracted line item instead of a single summary line, mapping each to an account code from a supplier lookup sheet.
  • +Match suppliers by ABN as well as name by storing the ABN in each Xero contact's tax number field.
  • +Check for duplicates by searching Xero for an existing bill with the same supplier and invoice number before creating a new one.
  • +Add a Gmail node at the end that labels processed emails, so the inbox shows what has already been handled.
  • +Swap the Gmail trigger for a Microsoft Outlook Trigger or a Google Drive folder trigger if invoices arrive another way.

FOR AUSTRALIAN BUSINESSES

Australian tax invoices must show the supplier's ABN, and you generally need a valid tax invoice to claim a GST credit, which is why the workflow checks the ABN checksum and sends missing ones to a person. Draft bills use Xero's Australian tax codes: INPUT (GST on Expenses) when GST is charged and EXEMPTEXPENSES (GST Free Expenses) when it is not. The ATO expects you to keep records, including invoices, for five years, so keep the original PDFs in email or Drive rather than relying on the extracted text. Invoices can contain personal information, such as sole traders' names and addresses. Sending them to an overseas AI API is a cross-border disclosure under APP 8 of the Privacy Act 1988, so check the provider's data terms, and consider self-hosting n8n in an Australian region.

Need it hosted in Australia? →

006 / TOOLS IN THIS WORKFLOW

007 / QUESTIONS

Anything else is quicker to answer on a call. Thirty minutes, free, with the people who would build it.

No. The Xero node creates bills with the status Draft only. A person still has to open each bill in Xero, check the coding and GST, and approve it before it appears in payment runs. Nothing in the workflow touches payments or bank feeds.

We set up n8n end to end: hosting in Australia, connecting your systems, testing with real data and handing over documentation.

Book a free call→