Advanced Spreadsheets and Reporting Documentation
Index

Templates

A template is a reusable rectangle of a spreadsheet — everything inside it travels: cell values and formulas, styles, the regions it contains (with their field lists), conditional formats, dragged column widths and row heights, and the sheet's init code. Templates let you build a dashboard once and stamp it onto any sheet, anywhere, as many times as you like.

Saving a Template

There are two ways to store one:

  1. Sheet → Save as Template… in the editor. The current selection seeds the content range.
  2. Regions → Save as Template on the region list. The selected region's rectangle seeds the content range.

The dialog asks for:

Field Meaning
Code The template's unique code. Saving with an existing code replaces that template's content.
Description Shown on the gallery card.
Content Range The rectangle that gets stored, for example A1:AL45. Include the helper columns a dashboard calculates in — anything outside this rectangle is left behind, and the inserted copy's cards and charts would point at empty cells.
Preview Range The rectangle the gallery card pictures — normally the dashboard without its helper columns. Leave blank to use the largest page region inside the content range (a dashboard's own tab), falling back to the whole content range.

Content is stored normalized to A1: the rectangle's top-left corner shifts to A1 and every relative reference shifts along, so the template can be applied at any target cell later. $-pinned reference parts stay put through the shifts, exactly like copy and paste.

The preview picture is rendered by the editor right after the dialog closes, from the live sheet.

What travels with a template

  • Cells (values, formulas, styles) inside the content range.
  • Every region whose rectangle lies fully inside the content range, including table regions' field lists. Virtual-column values are sheet data and do not travel — an applied virtual column starts empty (its column formula does travel).
  • Conditional formats whose range lies fully inside the content range (threshold expressions shift along).
  • Dragged column widths and row heights inside the rectangle.
  • The source sheet's init code. A dashboard's formulas often call init-code procedures, so a template without it would insert as a screen full of unknown identifiers.

Applying a Template

Sheet → Insert Template… opens the visual gallery — every stored template as a card built around its preview picture. Picking one applies it with its A1 on the active cell.

When a template is applied:

  • Existing content in the covered cells is overwritten.
  • All references shift to the target position; $-pins hold.
  • A contained region whose ID already exists on the sheet is renamed with a numeric suffix (VE becomes VE_2), and every formula referencing it is rewritten to match — so inserting the same template twice yields two independent, working copies.
  • The template's init-code procedures are merged into the sheet's init code: procedures whose names the sheet already declares are skipped (inserting two templates that both carry a SafeDiv does not produce a duplicate), and nothing existing is ever removed.
  • A template that would not fit on the sheet at the target cell is refused with an error.

Example: One KPI Block, Reused Everywhere

You built a tidy revenue block on your sales sheet: a KPI card over B4:D7, its value formula in AB3 (=GL.GLSum('40000..49999', C2)), a label beside it, and a period slicer in C2.

  1. Select A1:AC10 — the visible block and its helper column — and choose Sheet → Save as Template….
  2. Code REV-BLOCK, description Revenue KPI block. Content Range is already A1:AC10; set Preview Range to A1:M10 so the gallery card shows the block without the helpers. Save.
  3. On any other sheet, put the cursor where the block should land and choose Sheet → Insert Template… → REV-BLOCK. Everything arrives shifted to that spot: the card, the formula, the slicer — working immediately.
  4. Insert it a second time on the same sheet for a second period comparison: the contained region comes in renamed (KPI → KPI_2) with its formulas rewritten, so the two copies stay independent.

Managing Templates

The Spreadsheet Templates list page shows every template with its code, description, preview, size, source sheet and creation time, plus an Init Code column indicating whether the source sheet's init code travelled with it (templates stored before that feature should be saved again).

Standard templates

The Populate Standard Templates action creates (or refreshes) ready-to-use dashboard templates together with the working spreadsheets they are built from — currently Item Focused Sales (ITEM-SALES: revenue, quantity, margin and margin %) and Accounts Payable - Detail (AP-DETAIL). Because they are generated without a browser client, they first appear in the gallery as a "No preview yet" placeholder card: open the generated sheet and save it again as a template from the Sheet menu to fill the picture in. The Gross Margin and Overdue KPI cards on these dashboards show their value without a comparison percentage.