Cell.Name
Cell.Name is an object type of the Spreadsheet module (Office.cell(iframe)). 9 methods.
Remarks
- Module: Spreadsheet ·
Office.cell(iframe)· namespaceCell - Obtained from:
Workbook.addDefinedName(name, formula, sheet),Workbook.getDefinedName(name, sheet) - Every method returns a
Promise; signatures use TypeScript notation.
Methods
| Method | Description |
|---|---|
delete() | Deletes the defined name. |
getFormula() | Returns the formula that this name points to. |
getInfo() | Returns the name, the scope sheet, the formula, and the referenced ranges in a single call. |
getName() | Returns the name. |
getRanges() | Returns the ranges that this name actually refers to. |
getSheetName() | Returns the name of the sheet that this name is scoped to. |
setFormula(formula) | Changes the formula that the defined name points to. |
setName(newName) | Renames the defined name. |
update(fields) | Changes the name and the formula of the defined name in a single call. |
Method details
delete()
Deletes the defined name.
delete(): Promise<void>;
Returns
none
getFormula()
Returns the formula that this name points to. Relative references in the formula are resolved against the active cell of the active sheet, so the return value can change with the active cell even for the same name.
getFormula(): Promise<string>;
Returns
Promise<string> - formula starting with =
getInfo()
Returns the name, the scope sheet, the formula, and the referenced ranges in a single call. Each value matches getName(), getSheetName(), getFormula(), and getRanges().
getInfo(): Promise<NameInfo>;
Returns
Promise<NameInfo> - Formulas start with =
getName()
Returns the name.
getName(): Promise<string>;
Returns
Promise<string>
getRanges()
Returns the ranges that this name actually refers to. Multiple ranges are joined with commas, and each range always includes the sheet name.
getRanges(): Promise<string>;
Returns
Promise<string> - empty string if the name refers to a constant or an error, or uses an unsupported function
getSheetName()
Returns the name of the sheet that this name is scoped to.
getSheetName(): Promise<string | null>;
Returns
Promise<string | null> - sheet name if the name is sheet-scoped, null if the name is workbook-scoped
setFormula(formula)
Changes the formula that the defined name points to. References in the formula that do not specify a sheet are resolved against the active sheet, regardless of the scope of the name.
setFormula(formula: string): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
formula | string | new formula or reference |
Returns
none
setName(newName)
Renames the defined name. A name cannot be changed to a name that already exists in the same scope or to a table name.
setName(newName: string): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
newName | string | new name. It cannot contain spaces or disallowed characters, and reserved names, names that read as cell references, and names longer than the maximum length are not accepted |
Returns
none
update(fields)
Changes the name and the formula of the defined name in a single call. Throws an error if no item to change is given.
update(fields: NameUpdate): Promise<void>;
Parameters
| Name | Type | Description |
|---|---|---|
fields | NameUpdate | items to change |
Returns
none