Xero invoice lines in a live spreadsheet

Add the Invoice lines table to a sheet as a data source named invoice_lines and its 26 columns become names your formulas, pivot tables and charts use. Sheets reads it from your Xero organisation each time the sheet opens or refreshes.

Formulas on this table

=data.invoice_lines.sum(quantity)
Total quantity. Adds up the Quantity column over every row of Invoice lines.
=data.invoice_lines.sum(quantity, contact, A2)
Quantity per contact. With a contact in A2, the total for that one. Fill it down next to a list of them.
=list.invoice_lines(contact)
Every contact, once. Spills the distinct contact values down the column: the row labels for the formula above.
=data.invoice_lines.sum(quantity, date, ">=2026-01-01")
Since a date. Only rows whose Date is on or after 1 January 2026. Criteria such as ">=", "<" and "<>" work as in any spreadsheet.
=data.invoice_lines.count(document_id, contact, "<>")
Rows with a contact. Counts the rows whose Contact is not empty.
=data.invoice_lines.avg(unit_price)
Average unit price. avg, min, max, count, countd (distinct) and first work the same way as sum.

Reports that use it

=data.invoice_lines.sum(line_amount_excl_tax, item_code, A2)
Sales by item. Invoice lines per item code, before tax.
=data.invoice_lines.sum(line_amount_excl_tax, tracking_1_option, A2)
Sales by tracking category. Revenue per tracking option (a region, a project, a department).

Columns

ColumnIn formulasType
Document IDdocument_idText
Invoice no.invoice_noText
DatedateDate
ContactcontactText
Contact IDcontact_idText
Payment statuspayment_statusText
StatusstatusText
DescriptiondescriptionText
Item codeitem_codeText
Account codeaccount_codeText
Account IDaccount_idText
QuantityquantityNumber
Unit priceunit_priceNumber
Discount %discountNumber
Line amountline_amountNumber
Line amount (excl. tax)line_amount_excl_taxNumber
Line taxline_taxNumber
Tax typetax_typeText
Amounts areamounts_areText
Tracking 1tracking_1Text
Tracking 1 optiontracking_1_optionText
Tracking 2tracking_2Text
Tracking 2 optiontracking_2_optionText
CurrencycurrencyText
Line IDline_idText
Updated atupdated_atDate and time

Other sales tables

Your invoice lines, live

Invoices, bills, bank transactions and your monthly profit and loss become tables that formulas, pivots and charts read directly, in your base currency.