Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 2.33 KB

File metadata and controls

83 lines (59 loc) · 2.33 KB

Workbook

Workbook is the top level object which contains related workbook objects such as worksheets, tables, ranges, etc. It can be used to list related references.

Properties

None

Relationships

The Workbook has the following relationships defined:

Relationship Type Description Notes
application Application Returns an object that represents the Excel application managing the workbook.
names NamedItem collection Collection of Named Ranges associated with the workbook Workbook.Names
tables Table collection Collection of Tables associated with the workbook Workbook.ListObjects
worksheets Worksheet collection Collection of Worksheets associated with the workbook Workbook.Worksheets
bindings Binding collection A collection of all the Binding objects that are part of the workbook.

Methods

The Worksheet has the following methods defined:

Method Return Type Description Notes
getActiveWorksheet() Worksheet object Get the currently active worksheet in the workbook.
getSelectedRange() Range object Get the currently selected Range from the Workbook.

API Specification

getActiveWorksheet()

Get the currently active worksheet in the workbook.

Syntax

context.workbook.getActiveWorksheet();

Parameters

None

Returns

Worksheet object.

Examples

var ctx = new Excel.ExcelClientContext();
var activeWorksheet = ctx.workbook.getActiveWorksheet();
ctx.load(activeWorksheet);
ctx.executeAsync().then(function () {
		Console.log(activeWorksheet.name);
});

Back

getSelectedRange()

Get the currently selected Range from the Workbook.

Syntax

context.workbook.getSelectedRange();

Parameters

None

Returns

Range object.

Examples

var ctx = new Excel.ExcelClientContext();
var selectedRange = ctx.workbook.getSelectedRange();
ctx.executeAsync().then(function () {
		Console.log(selectedRange.address);
});

Back