ExcelScript.WorkbookRangeAreas interface

Represents a collection of one or more rectangular ranges in multiple worksheets.

Remarks

Examples

/**
 * This script finds the direct precedents of the active cell.
 * It changes the font and color of those precedent cells. 
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the active cell.
  const selected = workbook.getActiveCell();
  
  // Get the cells that are direct precedents of the current cell.
  const precedents : ExcelScript.WorkbookRangeAreas = selected.getDirectPrecedents();

  // Set the font to bold and the fill color to orange for all the precedent cells.
  precedents.getRanges().forEach(range => {
    range.getFormat().getFill().setColor("orange");
    range.getFormat().getFont().setBold(true);
  });
}

Methods

getAddresses()

Returns an array of addresses in A1-style. Address values contain the worksheet name for each rectangular block of cells (e.g., "Sheet1!A1:B4, Sheet1!D1:D4"). Read-only.

getAreas()

Returns the RangeAreasCollection object. Each RangeAreas in the collection represent one or more rectangle ranges in one worksheet.

getRangeAreasBySheet(key)

Returns the RangeAreas object based on worksheet name or ID in the collection. If the worksheet does not exist, then this method returns undefined.

getRanges()

Returns ranges that comprise this object in a RangeCollection object.

Method Details

getAddresses()

Returns an array of addresses in A1-style. Address values contain the worksheet name for each rectangular block of cells (e.g., "Sheet1!A1:B4, Sheet1!D1:D4"). Read-only.

getAddresses(): string[];

Returns

string[]

getAreas()

Returns the RangeAreasCollection object. Each RangeAreas in the collection represent one or more rectangle ranges in one worksheet.

getAreas(): RangeAreas[];

Returns

getRangeAreasBySheet(key)

Returns the RangeAreas object based on worksheet name or ID in the collection. If the worksheet does not exist, then this method returns undefined.

getRangeAreasBySheet(key: string): RangeAreas;

Parameters

key

string

The name or ID of the worksheet.

Returns

getRanges()

Returns ranges that comprise this object in a RangeCollection object.

getRanges(): Range[];

Returns