Skip to main content

GetAddress

Returns the range address.

Syntax​

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

expression - A variable that represents an 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​

Read the cell address of a range and display it in another cell in a spreadsheet.

// How do I find out the address of a selected range in a spreadsheet?

// Copy a range address into a label cell to document its location on the sheet.

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);