Skip to main content

GetAddress

Returns the range address.

Syntax

expression.GetAddress(RowAbs, ColAbs, RefStyle, External, RelativeTo);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
RowAbsRequiredbooleanDefines if the link to the row is absolute or not.
ColAbsRequiredbooleanDefines if the link to the column is absolute or not.
RefStyleRequiredstringThe reference style.
ExternalRequiredbooleanDefines if the range is in the current file or not.
RelativeToRequiredApiRangeThe range which the current range is relative to.

Returns

string | null

Example

Get the range address in a spreadsheet.

// How to get an address of a range in a spreadsheet.

// Get an address of one range and set it for another one in a spreadsheet.

let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("1");
worksheet.GetRange("B1").SetValue("2");
let address = worksheet.GetRange("A1").GetAddress(true, true, "xlA1", false);
worksheet.GetRange("A3").SetValue("Address: ");
worksheet.GetRange("B3").SetValue(address);