Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 2.11 KB

excel-add-ins-ranges-unbounded.md

File metadata and controls

40 lines (29 loc) · 2.11 KB
title description ms.date ms.localizationpriority
Read or write to an unbounded range using the Excel JavaScript API
Learn how to use the Excel JavaScript API to read or write to an unbounded range.
02/17/2022
medium

Read or write to an unbounded range using the Excel JavaScript API

This article describes how to read and write to an unbounded range with the Excel JavaScript API. For the complete list of properties and methods that the Range object supports, see Excel.Range class.

An unbounded range address is a range address that specifies either entire columns or entire rows. For example:

  • Range addresses comprised of entire columns.
    • C:C
    • A:F
  • Range addresses comprised of entire rows.
    • 2:2
    • 1:4

Read an unbounded range

When the API makes a request to retrieve an unbounded range (for example, getRange('C:C')), the response will contain null values for cell-level properties such as values, text, numberFormat, and formula. Other properties of the range, such as address and cellCount, will contain valid values for the unbounded range.

Write to an unbounded range

You cannot set cell-level properties such as values, numberFormat, and formula on an unbounded range because the input request is too large. For example, the following code example is not valid because it attempts to specify values for an unbounded range. The API returns an error if you attempt to set cell-level properties for an unbounded range.

// Note: This code sample attempts to specify `values` for an unbounded range, which is not a valid request. The sample will return an error. 
let range = context.workbook.worksheets.getActiveWorksheet().getRange('A:B');
range.values = 'Due Date';

See also