QuvanticBook free audit

ZapierChecked blueprint7 nodes

Draft a Xero bill from an invoice email

Turn a labelled supplier invoice email into a draft Xero bill, skipping duplicates and anything the parser was unsure about.

Portfolio reference build with demo data and placeholder credentials, not a client deployment.

Pain

Stops opening PDFs, typing vendor totals, and hoping nobody pays the same bill twice.

Solution

Turn a labelled supplier invoice email into a draft Xero bill, skipping duplicates and anything the parser was unsure about.

Impact · From the blueprint

About 4 minutes per bill, and duplicate bills stop reaching the approval queue.

Library status: passing. Schema, field mapping, task count, and Code-step unit tests pass. Not built in a live Zapier account.

Draft a Xero bill from an invoice email step list
Step list

Step inspector

The first step shows the checked-in sample payload.Later steps name the node. They are not a live execution.

Guardrails

  • Filter by Zapier · Only continue if...

Credential ids in the JSON are placeholders. These files are portfolio demos.

Deploy this for your business

Tell us this slug and what still happens by hand. We will map it onto your accounts. This page is not a claim that the blueprint already runs for a customer.

README

Portfolio demo by Mustafa (mustafaautomation). Not client work. The people, companies, and numbers in it are made up. Rebuild it in your own Zapier account. Nothing here is connected to anyone's account.

Category: Invoices and documents
Difficulty: intermediate
Apps: Gmail, AI by Zapier, Code by Zapier, Google Sheets, Filter by Zapier, Xero
Zapier plan: Professional (multi-step Zap: 6 steps after the trigger; Filter by Zapier; AI by Zapier; premium app: Xero)
Tasks per run: 5
Test status: passing (schema, mapping scope, task count, Code step unit tests)

Problem

Bills reach Xero late because someone has to copy each emailed invoice in by hand. When the same supplier emails a reminder with the same invoice attached, it sometimes gets entered twice.

Who it's for

Bookkeepers and operations managers on Xero who receive supplier invoices by email and approve bills in Xero before paying them.

How the Zap runs

flowchart TD
  s1["1. Gmail: New Labeled Email<br/>New email under Invoices/Xero"]
  s2["2. AI by Zapier<br/>Pull the invoice fields"]
  s1 --> s2
  s3["3. Code by Zapier<br/>Turn the printed total into cents"]
  s2 --> s3
  s4["4. Google Sheets<br/>Check the bill log for this invoice number"]
  s3 --> s4
  s5{{"5. Filter by Zapier<br/>Only new invoices with a clean amount"}}
  s4 --> s5
  s6["6. Xero<br/>Create the draft bill"]
  s5 -->|"passes"| s6
  s7["7. Google Sheets<br/>Log the bill"]
  s6 --> s7

Build it in the Zapier editor

Zapier has no import file for a Zap like this one, so it is built by hand from the steps below. zap.json is the same Zap in a machine-readable form (schema), and zap.yaml is the same document in YAML.

A value like [2. vendor] means: click the field, open step 2 in the data picker, and choose vendor. Plain text is typed as shown. YOUR_... is a value from your own account.

Before you start

  • Create the sheet Payables › Xero bills with these headers in row 1: invoice_number, vendor, amount, currency, due_date, xero_bill_id, created_at.
  • In Xero, note the account code bills should land in (for example 429 General Expenses) for YOUR_EXPENSE_ACCOUNT_CODE.
  • Have these ready from your own accounts: YOUR_EXPENSE_ACCOUNT_CODE, YOUR_XERO_ORGANISATION.

Steps

1. Trigger: New email under Invoices/Xero

App: Gmail · Event: New Labeled Email · polling (Zapier checks on your plan's update interval) · Tasks: 0

Fires for each email under the Invoices/Xero label. Use a Gmail filter on your main suppliers, or label by hand.

FieldValue
LabelInvoices/Xero

Fields this library maps from the trigger: message_id, thread_id, from_email, from_name, to, subject, date, body_plain, snippet, labels, attachment_count, attachment_names. Zapier shows them with its own labels; pick the one with the same meaning.

2. Action: Pull the invoice fields

App: AI by Zapier · Event: Analyze and Return Data · Tasks: 1

Same extraction prompt as the sheet template, so both Zaps agree on what a field means.

FieldValue
ModelDefault (fast)
InstructionsYou read supplier invoices for an accounts-payable team. From the email below, return: vendor (the company that sent the invoice), invoice_number (exactly as printed), invoice_date and due_date (YYYY-MM-DD, empty if not stated), total_text (the grand total exactly as printed, with its currency symbol or code, for example "$1,280.00" or "1.280,00 EUR"), currency (ISO code if you can tell, otherwise empty), line_summary (one short line describing what was bought), and text_found ("yes" if the email text actually contains the invoice figures, "no" if the figures are only inside an attachment you cannot read). Never invent a number. If a value is not in the text, leave it empty.
Input dataFrom: [1. from_name] <[1. from_email]>
Subject: [1. subject]

[1. body_plain]
Output fieldsvendor, invoice_number, invoice_date, due_date, total_text, currency, line_summary, text_found

Later steps can map: vendor, invoice_number, invoice_date, due_date, total_text, currency, line_summary, text_found.

3. Action: Turn the printed total into cents

App: Code by Zapier · Event: Run JavaScript · Tasks: 1

Xero needs a plain decimal. This step returns one, and flags formats it cannot read with certainty.

Paste the whole of code/parse-money.js into the code box. Source: content/code/parse-money.cjs. Unit tests: content/code/parse-money.test.cjs.

Input Data keyValue
amount_text[2. total_text]
currency_hint[2. currency]

Returns: amount, amount_fixed, amount_cents, currency, format, needs_review.

4. Search: Check the bill log for this invoice number

App: Google Sheets · Event: Lookup Spreadsheet Row · Tasks: 1

Looks for the invoice number in the log the Zap writes, so a reminder email for the same invoice does not create a second bill.

FieldValue
DriveMy Google Drive
SpreadsheetPayables
WorksheetXero bills
Lookup Columninvoice_number
Lookup Value[2. invoice_number]
Should this step be considered a "success" when nothing is found?Yes

Later steps can map: row_number, _zap_search_was_found_status, xero_bill_id.

5. Filter: Only new invoices with a clean amount

App: Filter by Zapier · Event: Only continue if... · Tasks: 0

Stops the run when the invoice is already logged, the amount was ambiguous, or the figures were not in the email text. Those stay under the label for a person.

Only continue if: [4. _zap_search_was_found_status] (Boolean) Is false and [3. needs_review] (Boolean) Is false and [2. text_found] (Text) Exactly matches yes.

Most runs pass this filter.

6. Action: Create the draft bill

App: Xero · Event: Create Bill · Tasks: 1

Creates the bill as a draft, never approved, so a person still approves payment in Xero.

FieldValue
OrganizationYOUR_XERO_ORGANISATION
Contact[2. vendor]
Invoice Number[2. invoice_number]
Date[2. invoice_date]
Due Date[2. due_date]
StatusDraft
Currency Code[3. currency]
Line Amount TypesTax Inclusive
Line Item Description[2. line_summary]
Line Item Quantity1
Line Item Unit Price[3. amount_fixed]
Line Item AccountYOUR_EXPENSE_ACCOUNT_CODE

Later steps can map: id, invoice_id, url.

7. Action: Log the bill

App: Google Sheets · Event: Create Spreadsheet Row · Tasks: 1

Records the Xero bill id against the invoice number. The next run's duplicate check reads this sheet.

FieldValue
DriveMy Google Drive
SpreadsheetPayables
WorksheetXero bills
Columns › invoice_number[2. invoice_number]
Columns › vendor[2. vendor]
Columns › amount[3. amount_fixed]
Columns › currency[3. currency]
Columns › due_date[2. due_date]
Columns › xero_bill_id[6. invoice_id]
Columns › created_at[Zap meta › human_now]

Later steps can map: id, row_number.

Test it

Use sample-trigger.json as the test record. For an instant or webhook trigger, send it to the trigger once; for a polling trigger, create a matching record in the app and click Test trigger. Then test each step in order and read its output before you turn the Zap on.

{
  "message_id": "18c2f4a9b7d01e55",
  "thread_id": "18c2f4a9b7d01e55",
  "from_email": "accounts@harbor-goods.example",
  "from_name": "Harbor Goods Accounts",
  "to": "ap@northwind-studio.example",
  "subject": "Invoice INV-001842 from Harbor Goods",
  "date": "2026-11-24T09:14:03Z",
  "body_plain": "Hello Northwind Studio team,\n\nPlease find invoice INV-001842 for the November studio supplies order.\n\nInvoice date: 2026-11-21\nDue date: 2026-12-21\nItems: 40 x linen aprons, 25 x stoneware mugs\nTotal due: $1,280.00\n\nBank details are on the attached PDF.\nThanks,\nHarbor Goods Accounts",
  "snippet": "Please find invoice INV-001842 for the November studio supplies order.",
  "labels": "INBOX, Invoices/Xero",
  "attachment_count": 1,
  "attachment_names": "INV-001842.pdf"
}

Plan and task usage

StepAppTasks
1. New email under Invoices/XeroGmail0
2. Pull the invoice fieldsAI by Zapier1
3. Turn the printed total into centsCode by Zapier1
4. Check the bill log for this invoice numberGoogle Sheets1
5. Only new invoices with a clean amountFilter by Zapier0
6. Create the draft billXero1
7. Log the billGoogle Sheets1

A typical run uses 5 tasks. Zapier does not charge tasks for triggers, Filter, Paths, Formatter, Delay, Looping, Digest, Storage, or Zapier Tables steps. AI by Zapier is counted here as 1 task; Zapier prices it by model tier, so a larger model can cost more.

Minimum plan: Professional, because of: multi-step Zap: 6 steps after the trigger; Filter by Zapier; AI by Zapier; premium app: Xero. The Free plan only runs two-step Zaps (a trigger and one action) and leaves out Filters, Paths, Formatter, webhooks, AI by Zapier, and premium apps.

Customize

  • Add a Xero Find Contact search before the bill if your supplier names in Xero differ from how they sign emails.
  • Change the filter to let ambiguous amounts through and set Status to Draft anyway, if your team prefers fixing drafts in Xero over fixing sheet rows.
  • Map tax handling to match your region: "Tax Exclusive" for US-style invoices, "Tax Inclusive" for most UK and AU suppliers.

Limits

  • Xero is a premium app on Zapier, so this needs a paid plan regardless of step count.
  • One line per bill. Itemised bills need the line items from a PDF parser, which Gmail alone does not provide.

Time saved

About 4 minutes per bill, and duplicate bills stop reaching the approval queue.

Files

FileWhat it is
zap.jsonThe Zap, step by step, in schema 1.0.0.
zap.yamlThe same document in YAML.
sample-trigger.jsonFictional trigger record for the first test.
diagram.pngThe step list, drawn like the Zapier editor.
code/parse-money.jsPaste-ready Code by Zapier step.