From 4611a526877fbd97de039fd377f9f0cd5440f785 Mon Sep 17 00:00:00 2001 From: Alison McKay Date: Tue, 23 Sep 2025 17:04:17 -0700 Subject: [PATCH 1/6] Add troubleshoot updates --- docs/excel/excel-add-ins-troubleshooting.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/excel/excel-add-ins-troubleshooting.md b/docs/excel/excel-add-ins-troubleshooting.md index 0b8fa0fde..59499d48d 100644 --- a/docs/excel/excel-add-ins-troubleshooting.md +++ b/docs/excel/excel-add-ins-troubleshooting.md @@ -1,12 +1,12 @@ --- -title: Troubleshooting Excel add-ins -description: Learn how to troubleshoot development errors in Excel add-ins. +title: Troubleshoot Excel add-ins +description: 'Diagnose and resolve common Excel add-in errors: workbook focus changes, API limitations, and known issues.' ms.date: 09/22/2025 ms.topic: troubleshooting-error-codes ms.localizationpriority: medium --- -# Troubleshooting Excel add-ins +# Troubleshoot Excel add-ins This article discusses troubleshooting issues that are unique to Excel. Please use the feedback tool at the bottom of the page to suggest other issues that can be added to the article. @@ -38,11 +38,11 @@ The following APIs are affected by this workbook switch. > [!NOTE] > This only applies to multiple Excel workbooks open on Windows or Mac. -## Coauthoring +## Coauthoring and merge conflicts See [Coauthoring in Excel add-ins](co-authoring-in-excel-add-ins.md) for patterns to use with events in a coauthoring environment. The article also discusses potential merge conflicts when using certain APIs, such as [`TableRowCollection.add`](/javascript/api/excel/excel.tablerowcollection#excel-excel-tablerowcollection-add-member(1)). -## Known Issues +## Known issues ### Binding events return temporary `Binding` objects From 0a14674dd8d700bc4aa710eea2805ecced2f074d Mon Sep 17 00:00:00 2001 From: Alison McKay Date: Wed, 24 Sep 2025 14:09:51 -0700 Subject: [PATCH 2/6] Add remove duplicates updates --- .../excel-add-ins-ranges-remove-duplicates.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/excel/excel-add-ins-ranges-remove-duplicates.md b/docs/excel/excel-add-ins-ranges-remove-duplicates.md index f868e56e3..f55eefc89 100644 --- a/docs/excel/excel-add-ins-ranges-remove-duplicates.md +++ b/docs/excel/excel-add-ins-ranges-remove-duplicates.md @@ -1,17 +1,26 @@ --- title: Remove duplicates using the Excel JavaScript API description: Learn how to use the Excel JavaScript API to remove duplicates. -ms.date: 02/17/2022 +ms.date: 09/22/2025 ms.localizationpriority: medium --- # Remove duplicates using the Excel JavaScript API -This article provides a code sample that removes duplicate entries in a range using the Excel JavaScript API. For the complete list of properties and methods that the `Range` object supports, see [Excel.Range class](/javascript/api/excel/excel.range). +This article shows how to remove duplicate rows within a range using the [Range.removeDuplicates](/javascript/api/excel/excel.range#excel-excel-range-removeduplicates-member(1)) method. For the full list of range members, see [Excel.Range class](/javascript/api/excel/excel.range). + +## Key points + +- It works only inside the supplied `range`. +- Column indexes are zero-based and relative to the range. +- Set `includeHeader: true` to skip the first row when checking duplicates. +- Empty cells count like any other value. Two empty cells can be duplicates. +- It compares stored cell values, not formula logic. +- It returns `RemoveDuplicatesResult` with `removed` and `uniqueRemaining` counts. ## Remove rows with duplicate entries -The [Range.removeDuplicates](/javascript/api/excel/excel.range#excel-excel-range-removeduplicates-member(1)) method removes rows with duplicate entries in the specified columns. The method goes through each row in the range from the lowest-valued index to the highest-valued index in the range (from top to bottom). A row is deleted if a value in its specified column or columns appeared earlier in the range. Rows in the range below the deleted row are shifted up. `removeDuplicates` does not affect the position of cells outside of the range. +The `removeDuplicates` method removes rows with duplicate entries in the specified columns. The method goes through each row in the range from the lowest-valued index to the highest-valued index in the range (from top to bottom). A row is deleted if a value in its specified column or columns appeared earlier in the range. Rows in the range below the deleted row are shifted up. `removeDuplicates` does not affect the position of cells outside of the range. `removeDuplicates` takes in a `number[]` representing the column indices which are checked for duplicates. This array is zero-based and relative to the range, not the worksheet. The method also takes in a boolean parameter that specifies whether the first row is a header. When `true`, the top row is ignored when considering duplicates. The `removeDuplicates` method returns a `RemoveDuplicatesResult` object that specifies the number of rows removed and the number of unique rows remaining. From 578688a45a78da0081e66e2f43bf09f998c4db3f Mon Sep 17 00:00:00 2001 From: Alison McKay Date: Wed, 24 Sep 2025 15:34:37 -0700 Subject: [PATCH 3/6] Add unbounded ranges changes --- docs/excel/excel-add-ins-ranges-unbounded.md | 43 ++++++++++++++++---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/docs/excel/excel-add-ins-ranges-unbounded.md b/docs/excel/excel-add-ins-ranges-unbounded.md index b9d348278..ac70763b9 100644 --- a/docs/excel/excel-add-ins-ranges-unbounded.md +++ b/docs/excel/excel-add-ins-ranges-unbounded.md @@ -1,15 +1,24 @@ --- title: Read or write to an unbounded range using the Excel JavaScript API -description: Learn how to use the Excel JavaScript API to read or write to an unbounded range. -ms.date: 02/17/2022 +description: Understand what unbounded ranges are, why cell-level operations return null or fail, and how to safely work with entire rows or columns by narrowing scope. +ms.date: 09/22/2025 ms.localizationpriority: 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](/javascript/api/excel/excel.range). +Use these guidelines to understand how entire-column and entire-row addresses behave, and apply patterns that reduce errors and memory usage. For the complete list of properties and methods that the `Range` object supports, see [Excel.Range class](/javascript/api/excel/excel.range). -An unbounded range address is a range address that specifies either entire columns or entire rows. For example: +## Key points + +- "Unbounded" means entire columns (like `A:F`) or entire rows (such as `2:2`). +- Cell-level properties (like `values`, `text`, `numberFormat`, or `formulas`) come back as `null` for unbounded reads. +- You can't set cell-level properties on an unbounded range. This returns an error. +- Always narrow to the used cells first. +- Use `getUsedRange()` or intersect with a bounded range to get real cells. +- Prefer explicit bounds (like `A1:F5000`) for speed and lower memory use. + +The following are examples of unbounded ranges. - Range addresses comprised of entire columns. - `C:C` @@ -20,18 +29,34 @@ An unbounded range address is a range address that specifies either entire colum ## 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. +When you request an unbounded range (for example, `getRange('C:C')`), the response returns `null` for cell-level properties like `values`, `text`, `numberFormat`, and `formula`. Other properties (`address`, `cellCount`) are still valid. ## 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. +You can't set cell-level properties like `values`, `numberFormat`, or `formula` on an unbounded range because the request is too large. For example, the next code sample fails because it sets `values` for an unbounded range. ```js -// 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'; +// Invalid: Attempting to write cell-level data to unbounded columns. +let range = context.workbook.worksheets.getActiveWorksheet().getRange("A:B"); +range.values = [["Due Date"]]; // This throws an error. ``` +## Alternatives to unbounded addresses + +| Goal | Prefer this approach | Why | +|------|----------------------|-----| +| Apply style to a column in use | `getUsedRange().getIntersection(sheet.getRange("A:A"))` | Avoid formatting unused cells | +| Add formulas to growing dataset | Write formulas only to populated rows; watch for new rows | Reduces recalculation work | +| Read dataset sized by import | Use `usedRange` then read in pages | Known size | +| Conditional formatting | Limit to known data rectangle | Better performance | + +## Next steps + +- Learn strategies for [large bounded ranges](excel-add-ins-ranges-large.md). +- Combine multiple explicit ranges with [multiple ranges](excel-add-ins-multiple-ranges.md). +- Optimize performance with [resource limits guidance](../concepts/resource-limits-and-performance-optimization.md#excel-add-ins). +- Identify specific cells using [special cells](excel-add-ins-ranges-special-cells.md). + ## See also - [Excel JavaScript object model in Office Add-ins](excel-add-ins-core-concepts.md) From f535bb59d2eb491b9276ef136a3c97d68de6a03d Mon Sep 17 00:00:00 2001 From: Alison McKay Date: Thu, 25 Sep 2025 19:33:26 -0700 Subject: [PATCH 4/6] Update PivotTable article --- docs/excel/excel-add-ins-pivottables.md | 39 ++++++++++++++----------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/docs/excel/excel-add-ins-pivottables.md b/docs/excel/excel-add-ins-pivottables.md index 1b854d33b..1c1a5c370 100644 --- a/docs/excel/excel-add-ins-pivottables.md +++ b/docs/excel/excel-add-ins-pivottables.md @@ -1,16 +1,23 @@ --- title: Work with PivotTables using the Excel JavaScript API -description: Use the Excel JavaScript API to create PivotTables and interact with their components. -ms.date: 03/04/2022 +description: Learn how to create, configure, and filter PivotTables programmatically with the Excel JavaScript API. +ms.date: 09/22/2025 ms.localizationpriority: medium --- # Work with PivotTables using the Excel JavaScript API -PivotTables streamline larger data sets. They allow the quick manipulation of grouped data. The Excel JavaScript API lets your add-in create PivotTables and interact with their components. This article describes how PivotTables are represented by the Office JavaScript API and provides code samples for key scenarios. +Use the PivotTable APIs to summarize data, group fields, filter, and apply calculations in a workbook. -If you are unfamiliar with the functionality of PivotTables, consider exploring them as an end user. -See [Create a PivotTable to analyze worksheet data](https://support.microsoft.com/office/ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=PivotTables) for a good primer on these tools. +## Key concepts + +- Four hierarchy categories: rows, columns, data, and filters. +- Adding a hierarchy to a new category removes it from the old one. +- `PivotLayout` gives you the output ranges (for example `getDataBodyRange`). +- Filtering options: code (PivotFilters) or UI (slicers). +- Add multiple hierarchies, then call `context.sync()` once for speed. + +If you're unfamiliar with PivotTables as an end user, review [Create a PivotTable to analyze worksheet data](https://support.microsoft.com/office/ccd3c4a6-272f-4c97-afbb-d3f27407fcde#ID0EBBD=PivotTables). > [!IMPORTANT] > PivotTables created with OLAP are not currently supported. There is also no support for Power Pivot. @@ -21,9 +28,9 @@ See [Create a PivotTable to analyze worksheet data](https://support.microsoft.co The [PivotTable](/javascript/api/excel/excel.pivottable) is the central object for PivotTables in the Office JavaScript API. -- `Workbook.pivotTables` and `Worksheet.pivotTables` are [PivotTableCollections](/javascript/api/excel/excel.pivottablecollection) that contain the [PivotTables](/javascript/api/excel/excel.pivottable) in the workbook and worksheet, respectively. -- A [PivotTable](/javascript/api/excel/excel.pivottable) contains a [PivotHierarchyCollection](/javascript/api/excel/excel.pivothierarchycollection) that has multiple [PivotHierarchies](/javascript/api/excel/excel.pivothierarchy). -- These [PivotHierarchies](/javascript/api/excel/excel.pivothierarchy) can be added to specific hierarchy collections to define how the PivotTable pivots data (as explained in the [following section](#hierarchies)). +- `Workbook.pivotTables` and `Worksheet.pivotTables` are [PivotTableCollections](/javascript/api/excel/excel.pivottablecollection) that contain the [PivotTables](/javascript/api/excel/excel.pivottable) in the workbook and worksheet. +- A [PivotTable](/javascript/api/excel/excel.pivottable) has a [PivotHierarchyCollection](/javascript/api/excel/excel.pivothierarchycollection) with multiple [PivotHierarchies](/javascript/api/excel/excel.pivothierarchy). +- [PivotHierarchies](/javascript/api/excel/excel.pivothierarchy) can be added to specific hierarchy collections to define how the PivotTable pivots data. - A [PivotHierarchy](/javascript/api/excel/excel.pivothierarchy) contains a [PivotFieldCollection](/javascript/api/excel/excel.pivotfieldcollection) that has exactly one [PivotField](/javascript/api/excel/excel.pivotfield). If the design expands to include OLAP PivotTables, this may change. - A [PivotField](/javascript/api/excel/excel.pivotfield) can have one or more [PivotFilters](/javascript/api/excel/excel.pivotfilters) applied, as long as the field's [PivotHierarchy](/javascript/api/excel/excel.pivothierarchy) is assigned to a hierarchy category. - A [PivotField](/javascript/api/excel/excel.pivotfield) contains a [PivotItemCollection](/javascript/api/excel/excel.pivotitemcollection) that has multiple [PivotItems](/javascript/api/excel/excel.pivotitem). @@ -37,9 +44,9 @@ This fruit farm sales data will be used to make a PivotTable. Each column, such ### Hierarchies -PivotTables are organized based on four hierarchy categories: [row](/javascript/api/excel/excel.rowcolumnpivothierarchy), [column](/javascript/api/excel/excel.rowcolumnpivothierarchy), [data](/javascript/api/excel/excel.datapivothierarchy), and [filter](/javascript/api/excel/excel.filterpivothierarchy). +PivotTables have four hierarchy categories: [row](/javascript/api/excel/excel.rowcolumnpivothierarchy), [column](/javascript/api/excel/excel.rowcolumnpivothierarchy), [data](/javascript/api/excel/excel.datapivothierarchy), and [filter](/javascript/api/excel/excel.filterpivothierarchy). -The farm data shown earlier has five hierarchies: **Farms**, **Type**, **Classification**, **Crates Sold at Farm**, and **Crates Sold Wholesale**. Each hierarchy can only exist in one of the four categories. If **Type** is added to column hierarchies, it cannot also be in the row, data, or filter hierarchies. If **Type** is subsequently added to row hierarchies, it is removed from the column hierarchies. This behavior is the same whether hierarchy assignment is done through the Excel UI or the Excel JavaScript APIs. +Our farm data has five hierarchies: **Farms**, **Type**, **Classification**, **Crates Sold at Farm**, and **Crates Sold Wholesale**. Each hierarchy can only exist in one of the four categories. If **Type** is added to column hierarchies, it cannot also be in the row, data, or filter hierarchies. If **Type** is subsequently added to row hierarchies, it is removed from the column hierarchies. This behavior is the same whether hierarchy assignment is done through the Excel UI or the Excel JavaScript APIs. Row and column hierarchies define how data will be grouped. For example, a row hierarchy of **Farms** will group together all the data sets from the same farm. The choice between row and column hierarchy defines the orientation of the PivotTable. @@ -55,7 +62,7 @@ This PivotTable could be generated through the JavaScript API or through the Exc ## Create a PivotTable -PivotTables need a name, source, and destination. The source can be a range address or table name (passed as a `Range`, `string`, or `Table` type). The destination is a range address (given as either a `Range` or `string`). +You provide a name, source, and destination. The source can be a range address or table name (passed as a `Range`, `string`, or `Table` type). The destination is a range address (given as either a `Range` or `string`). The following samples show various PivotTable creation techniques. ### Create a PivotTable with range addresses @@ -112,9 +119,7 @@ await Excel.run(async (context) => { ## Add rows and columns to a PivotTable -Rows and columns pivot the data around those fields' values. - -Adding the **Farm** column pivots all the sales around each farm. Adding the **Type** and **Classification** rows further breaks down the data based on what fruit was sold and whether it was organic or not. +Rows and columns define how data is grouped. Adding the **Farm** column groups all the sales around each farm. Adding the **Type** and **Classification** rows further breaks down the data based on what fruit was sold and whether it was organic or not. ![A PivotTable with a Farm column and Type and Classification rows.](../images/excel-pivots-table-rows-and-columns.png) @@ -238,7 +243,7 @@ await Excel.run(async (context) => { ### Other PivotLayout functions -By default, PivotTables adjust row and column sizes as needed. This is done when the PivotTable is refreshed. `PivotLayout.autoFormat` specifies that behavior. Any row or column size changes made by your add-in persist when `autoFormat` is `false`. Additionally, the default settings of a PivotTable keep any custom formatting in the PivotTable (such as fills and font changes). Set `PivotLayout.preserveFormatting` to `false` to apply the default format when refreshed. +By default, PivotTables adjust row and column sizes as needed. This occurs when the PivotTable is refreshed. `PivotLayout.autoFormat` specifies that behavior. Any row or column size changes made by your add-in persist when `autoFormat` is `false`. Additionally, the default settings of a PivotTable keep any custom formatting in the PivotTable (such as fills and font changes). Set `PivotLayout.preserveFormatting` to `false` to apply the default format when refreshed. A `PivotLayout` also controls header and total row settings, how empty data cells are displayed, and [alt text](https://support.microsoft.com/topic/44989b2a-903c-4d9a-b742-6a75b451c669) options. The [PivotLayout](/javascript/api/excel/excel.pivotlayout) reference provides a complete list of these features. @@ -417,7 +422,7 @@ await Excel.run(async (context) => { #### Create a slicer -You can create a slicer in a workbook or worksheet by using the `Workbook.slicers.add` method or `Worksheet.slicers.add` method. Doing so adds a slicer to the [SlicerCollection](/javascript/api/excel/excel.slicercollection) of the specified `Workbook` or `Worksheet` object. The `SlicerCollection.add` method has three parameters: +Create a slicer in a workbook or worksheet with the `slicers.add` method. This adds a slicer to the [SlicerCollection](/javascript/api/excel/excel.slicercollection) of the specified `Workbook` or `Worksheet` object. The `SlicerCollection.add` method has three parameters: - `slicerSource`: The data source on which the new slicer is based. It can be a `PivotTable`, `Table`, or string representing the name or ID of a `PivotTable` or `Table`. - `sourceField`: The field in the data source by which to filter. It can be a `PivotField`, `TableColumn`, or string representing the name or ID of a `PivotField` or `TableColumn`. @@ -467,7 +472,7 @@ await Excel.run(async (context) => { #### Style and format a slicer -You add-in can adjust a slicer's display settings through `Slicer` properties. The following code sample sets the style to **SlicerStyleLight6**, sets the text at the top of the slicer to **Fruit Types**, places the slicer at the position **(395, 15)** on the drawing layer, and sets the slicer's size to **135x150** pixels. +Adjust a slicer's display settings with `Slicer` properties. The following code sample sets the style to **SlicerStyleLight6**, sets the text at the top of the slicer to **Fruit Types**, places the slicer at the position **(395, 15)** on the drawing layer, and sets the slicer's size to **135x150** pixels. ```js await Excel.run(async (context) => { From e868f03cf154c165c50577659dbec691cae6b227 Mon Sep 17 00:00:00 2001 From: Alison McKay Date: Wed, 1 Oct 2025 16:19:43 -0700 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Elizabeth Samuel --- docs/excel/excel-add-ins-pivottables.md | 4 ++-- docs/excel/excel-add-ins-ranges-remove-duplicates.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/excel/excel-add-ins-pivottables.md b/docs/excel/excel-add-ins-pivottables.md index 1c1a5c370..519af1732 100644 --- a/docs/excel/excel-add-ins-pivottables.md +++ b/docs/excel/excel-add-ins-pivottables.md @@ -13,7 +13,7 @@ Use the PivotTable APIs to summarize data, group fields, filter, and apply calcu - Four hierarchy categories: rows, columns, data, and filters. - Adding a hierarchy to a new category removes it from the old one. -- `PivotLayout` gives you the output ranges (for example `getDataBodyRange`). +- `PivotLayout` gives you the output ranges (for example, `getDataBodyRange`). - Filtering options: code (PivotFilters) or UI (slicers). - Add multiple hierarchies, then call `context.sync()` once for speed. @@ -62,7 +62,7 @@ This PivotTable could be generated through the JavaScript API or through the Exc ## Create a PivotTable -You provide a name, source, and destination. The source can be a range address or table name (passed as a `Range`, `string`, or `Table` type). The destination is a range address (given as either a `Range` or `string`). +Provide a name, source, and destination. The source can be a range address or table name (passed as a `Range`, `string`, or `Table` type). The destination is a range address (given as either a `Range` or `string`). The following samples show various PivotTable creation techniques. ### Create a PivotTable with range addresses diff --git a/docs/excel/excel-add-ins-ranges-remove-duplicates.md b/docs/excel/excel-add-ins-ranges-remove-duplicates.md index f55eefc89..f67f79175 100644 --- a/docs/excel/excel-add-ins-ranges-remove-duplicates.md +++ b/docs/excel/excel-add-ins-ranges-remove-duplicates.md @@ -20,7 +20,7 @@ This article shows how to remove duplicate rows within a range using the [Range. ## Remove rows with duplicate entries -The `removeDuplicates` method removes rows with duplicate entries in the specified columns. The method goes through each row in the range from the lowest-valued index to the highest-valued index in the range (from top to bottom). A row is deleted if a value in its specified column or columns appeared earlier in the range. Rows in the range below the deleted row are shifted up. `removeDuplicates` does not affect the position of cells outside of the range. +The `removeDuplicates` method removes rows with duplicate entries in the specified columns. The method goes through each row in the range from the lowest-valued index to the highest-valued index in the range (from top to bottom). A row is deleted if a value in its specified column or columns appeared earlier in the range. Rows in the range below the deleted row are shifted up. `removeDuplicates` doesn't affect the position of cells outside of the range. `removeDuplicates` takes in a `number[]` representing the column indices which are checked for duplicates. This array is zero-based and relative to the range, not the worksheet. The method also takes in a boolean parameter that specifies whether the first row is a header. When `true`, the top row is ignored when considering duplicates. The `removeDuplicates` method returns a `RemoveDuplicatesResult` object that specifies the number of rows removed and the number of unique rows remaining. From 6d814c15d7a0c125701576235a10e5981f4102f0 Mon Sep 17 00:00:00 2001 From: Alison McKay Date: Wed, 1 Oct 2025 16:44:20 -0700 Subject: [PATCH 6/6] Clarify key point, remove jargon table --- docs/excel/excel-add-ins-ranges-unbounded.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/excel/excel-add-ins-ranges-unbounded.md b/docs/excel/excel-add-ins-ranges-unbounded.md index ac70763b9..f1449e140 100644 --- a/docs/excel/excel-add-ins-ranges-unbounded.md +++ b/docs/excel/excel-add-ins-ranges-unbounded.md @@ -14,9 +14,8 @@ Use these guidelines to understand how entire-column and entire-row addresses be - "Unbounded" means entire columns (like `A:F`) or entire rows (such as `2:2`). - Cell-level properties (like `values`, `text`, `numberFormat`, or `formulas`) come back as `null` for unbounded reads. - You can't set cell-level properties on an unbounded range. This returns an error. -- Always narrow to the used cells first. -- Use `getUsedRange()` or intersect with a bounded range to get real cells. -- Prefer explicit bounds (like `A1:F5000`) for speed and lower memory use. +- Narrow to the used cells first with `getUsedRange()`. +- Prefer explicit bounds (like `A1:F5000`) for faster calculation speeds and lower memory use. The following are examples of unbounded ranges. @@ -41,15 +40,6 @@ let range = context.workbook.worksheets.getActiveWorksheet().getRange("A:B"); range.values = [["Due Date"]]; // This throws an error. ``` -## Alternatives to unbounded addresses - -| Goal | Prefer this approach | Why | -|------|----------------------|-----| -| Apply style to a column in use | `getUsedRange().getIntersection(sheet.getRange("A:A"))` | Avoid formatting unused cells | -| Add formulas to growing dataset | Write formulas only to populated rows; watch for new rows | Reduces recalculation work | -| Read dataset sized by import | Use `usedRange` then read in pages | Known size | -| Conditional formatting | Limit to known data rectangle | Better performance | - ## Next steps - Learn strategies for [large bounded ranges](excel-add-ins-ranges-large.md).