TX Sheet Control

Named Ranges and External References

Topic

A name such as TaxRate or NetAmounts gives business meaning to a range or a constant, so that your formulas rely less on hardcoded addresses. A name belongs either to the workbook or to one worksheet, and names of the two kinds have a different lookup scope. References to other worksheets and to external workbooks follow rules of their own, which the sections below describe.

Define Names in Code

The following code defines a workbook name for a tax rate and a worksheet name for a column of net amounts, then uses both in a formula. editor is the Spreadsheet of the browser editor, created as in JavaScript:

const book = editor.workbook;
const sheet = book.sheets.at(0);
book.names.set('TaxRate', '=0.19');
sheet.names.set('NetAmounts', "='Sales'!$F$2:$F$25");
sheet.cell('H2').setFormula('=SUM(NetAmounts)*TaxRate');

The code works as follows:

Manage Names in the Editor

Open Formulas > Name Manager to review names across the workbook, including names scoped to other worksheets. Selecting a row leaves the worksheet selection unchanged. The list shows each name's calculated value, reference, scope and comment; long entries have tooltips with their full text.

Name Manager listing defined names and a table with their values, references, scope and comments

Use Search Names to find text in names, references, scopes or comments. The filter beside the command buttons narrows the list to worksheet names, workbook names, names with or without errors, defined names or table names. All Names clears the filter. Hidden name definitions are not listed.

  • New… opens a settings dialog where you enter a name, choose Workbook or a worksheet as its scope, supply a reference or formula and add an optional comment.
  • Edit…, or a double-click on a row, opens the selected definition. Its scope stays fixed. Select OK to apply the edit or Cancel to discard the draft.
  • Delete removes the selected defined name. Table names cannot be deleted here; manage the table on the worksheet.

Edit Name with a Definition section, fixed workbook scope, reference formula and comment field

To change only a definition's reference, edit Refers To below the list and select Apply Reference or press Enter. Revert discards that draft; Escape also reverts a changed reference. The range-picker button lets you select cells on a worksheet without changing the definition until you apply the reference. Selecting another name or closing with Close applies a pending reference edit; invalid edits remain visible for correction.

Table names appear with Workbook scope. Select Edit… to rename a table through the existing table operation, which also updates structured references. A table's reference is read-only in Name Manager: use Resize Table to change its range.

Name Manager keeps its header, toolbar and Close action in a fixed frame while the name list scrolls. In a narrow viewport, wider table columns scroll horizontally within the list. New Name and Edit Name use the same dialog elements with one Definition section and aligned fields; no separate preview is needed because Name Manager already lists calculated values.

Use the arrow keys, Home and End to select rows. Enter or F2 opens the selected name for editing, and Delete removes a selected defined name. Applied changes take effect immediately and can be undone after you close Name Manager. Closing the New Name or Edit Name dialog without confirming leaves its draft unapplied.

How Names Are Resolved

  • Case. Name matching is case-insensitive.
  • Scope. In the scope of a worksheet, a local worksheet name takes precedence over a workbook name that is equal to it.
  • Valid names. Use valid names that cannot be confused with cell references.
  • Renaming. Avoid renaming a template field without updating its consumers.

Write References

Relative references adjust with supported fill and copy operations. Absolute references retain the selected row or column. In formula text, quote sheet names that contain spaces and escape apostrophes. Use explicit worksheet handles when an operation must not depend on the active sheet.

Range handles accept supported rectangles, or names that resolve to them. Formula unions or intersections and three-dimensional references are calculation expressions, and not necessarily valid rectangle handles.

Bind External Workbooks

External references require explicitly supplied documents or compatible imported cached values. Configure external workbooks through the calculation API: Workbook.calculation returns the WorkbookCalculation, whose setExternalWorkbook binds a snapshot of an already loaded workbook under a name. Supply the correct named workbook, and refresh it deliberately when the source data changes.

Important

File Names in Formulas. Do not assume that a file name inside a formula grants permission to read an application file or a network URL.

Unbound references can report #REF!. Review the results before export. When a live external workbook is unnecessary, keep business-critical rates as known typed data.

What the File Keeps

Name definitions and supported native references participate in file persistence. Application callbacks and provider registrations remain application configuration.

Next Steps

  • Formulas: use names, sheet-qualified references and structured references in formulas.
  • Lifetime and Concurrency: manage the owners of documents, their handles, backend jobs and concurrency.