x0 Home Excel workbook

Excel workbook download (portal)

Viable: yes. The portal builds a personalized .xlsx so customers open one file and see tables. Opt-in scripts add Write/Create/Delete sheets plus VBA source (import into .xlsm).

Workbook type (dashboard)

Type Default Sheets
Accounts yes Intro, Parameters, PowerQuery, Endpoints (Accounts-focused), Accounts snapshot, Functions, Account_* / Tax type sheets
NZ forms A4 tax invoice, PO, quote, remittance, RFQ, cash receipt, service card, asset sale, customer statement, inventory transfer, faulty return, works order + lead register. Email from the add-in (excel-forms.md, email-forms.md)
Reports & Attachments Intro, Parameters, PowerQuery, Endpoints, DownloadHelp, Attachments, Reports, Reports_Table — kept out of the basic packs because they are heavy
All endpoints Intro, Parameters, PowerQuery, Endpoints index, one tab per core published entity (excludes Attachments / Reports / Reports_Table)
Other endpoint Intro, Parameters, PowerQuery, that endpoint’s snapshot only (single table; not reports/attachments)

Include scripts (Accounts only)

Dashboard checkbox Include scripts for write, create, delete, upload, archivedefault off.

Checkbox Behaviour
Off .xlsx — no Write/Create/Delete/Archive/Attachments sheets
On Same read sheets plus Write, Create, Attachments, CreateAttachment, Delete, Archive, MacroSetup (embeds AccountsActions.bas). Scripts are ignored for all / Reports & Attachments / other types.

openpyxl cannot embed a binary vbaProject; the download stays a valid .xlsx. Save as .xlsm and import the module from MacroSetup (or portal/excel_templates/AccountsActions.bas).

What you get (Accounts)

Sheet Purpose
Intro Connection card, security warning, first-time live steps
Endpoints Accounts + types + write API pointers
Parameters ApiBaseUrl, BearerToken, TenantId, BasicUsername / BasicPassword
PowerQuery Paste-ready M for live OData.Feed
Accounts Snapshot from warm cache
Functions Paste-ready OData / types URLs, VLOOKUP notes
Account_* / Tax_* SourceType enum tables for VLOOKUP
Write / Create / … Only when scripts on — field grids + macro names

What you get (Reports & Attachments)

Sheet Purpose
Intro / Parameters / PowerQuery Same connection card; Power Query sample targets Reports_Table
Endpoints Index of Attachments + Reports + download notes
DownloadHelp How to use DownloadPathGET /v1/attachments/{ParentType}/{ParentID}/{FileID}
Attachments Metadata catalog (RowKey, ParentType, FileName, DownloadPath, …)
Reports One row per report type (default date window from last sync)
Reports_Table Flattened report rows for Excel (ReportRowID, Cell0, Account, Amount, …)

Warm parent caches (Invoices, Contacts, Accounts, …) before refreshing Attachments. Re-download after portal Refresh for newer report periods. Live OData details: odata.md (Attachments / Reports sections).

API key scopes for this pack: xero.attachments.read, xero.reports.read, plus settings/types.

Boom vs live

Mode Behaviour
Snapshot (default) Server fills sheets from cache at download time
Live OData Intro / Functions / PowerQuery + Bearer from Parameters
Writes (scripts) VBA → PUT/POST/DELETE /v1/accounts… (scope xero.accounts.write)

Bearer token

Download issues a new key (excel-workbook) and embeds the secret once.

  • Accounts workbook scopes: xero.accounts.read xero.settings.read xero.types.read (+ xero.accounts.write if scripts)
  • Reports & Attachments: xero.attachments.read xero.reports.read xero.settings.read xero.types.read
  • All-endpoints: default DataScope set (core tables only in the file)
  • Revoke from dashboard if the file leaks; do not email the workbook

Portal

  • Dashboard → Download Excel workbook (POST /excel/workbook.xlsx)
  • Fields: workbook_type (accounts | forms | reports_attachments | all | endpoint code), include_scripts, org, environment
  • Optional ?snapshot=0 skips filling data tabs
  • Caps 5,000 rows per sheet

Code

Sign in to see connection status