GetParent
Returns the parent object for the specified collection.
Syntax
expression.GetParent();
expression - A variable that represents a ApiAreas class.
Parameters
This method doesn't have any parameters.
Returns
number
Example
Trace back from an areas collection to the original range it belongs to in a spreadsheet.
// How do I find the range that owns an areas collection in a spreadsheet?
// Navigate up from a group of areas to the single range that contains them all in a spreadsheet.
let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("B1:D1");
range.SetValue("1");
range.Select();
let areas = range.GetAreas();
let parent = areas.GetParent();
let type = parent.GetClassType();
range = worksheet.GetRange('A4');
range.SetValue("The areas parent: ");
range.AutoFit(false, true);
worksheet.GetRange('B4').Paste(parent);
range = worksheet.GetRange('A5');
range.SetValue("The type of the areas parent: ");
range.AutoFit(false, true);
worksheet.GetRange('B5').SetValue(type);