Skip to content

Commit 3e3ceda

Browse files
[excel] (Power Automate) Reorganize Power Automate limits about external calls (#612)
* Reorganize Power Automate limits about external calls * Adjust Workbook.refreshAllDataConnections in the PA method list * Apply suggestions from code review Co-authored-by: Alison McKay <[email protected]> --------- Co-authored-by: Alison McKay <[email protected]>
1 parent cdd18ce commit 3e3ceda

File tree

6 files changed

+34
-18
lines changed

6 files changed

+34
-18
lines changed

docs/develop/external-calls.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: External API call support in Office Scripts
33
description: Support and guidance for making external API calls in an Office Script.
4-
ms.date: 03/15/2023
4+
ms.date: 04/20/2023
55
ms.localizationpriority: medium
66
---
77

@@ -79,12 +79,7 @@ You can [apply IRM settings](/microsoft-365/compliance/apply-irm-to-a-list-or-li
7979
8080
## External calls from Power Automate
8181
82-
Any external API call fails when a script is run with Power Automate. This is a behavioral difference between running a script through the Excel application and through Power Automate. Be sure to check your scripts for such references before building them into a flow.
83-
84-
You'll have to use [HTTP with Azure AD](/connectors/webcontents/) or other equivalent actions to pull data from or push it to an external service.
85-
86-
> [!WARNING]
87-
> External calls made through the Power Automate [Excel Online connector](/connectors/excelonlinebusiness) fail in order to help uphold existing data loss prevention policies. However, scripts that are run through Power Automate are done so outside of your organization, and outside of your organization's firewalls. For additional protection from malicious users in this external environment, your admin can control the use of Office Scripts. Your admin can either disable the Excel Online connector in Power Automate or turn off Office Scripts for Excel through the [Office Scripts administrator controls](/microsoft-365/admin/manage/manage-office-scripts-settings).
82+
[!INCLUDE [External calls in Power Automate](../includes/external-calls-power-automate.md)]
8883
8984
## See also
9085
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
External API calls fail when a script is run through Power Automate. A `fetch` call will give the error message "Runtime error: Line X: fetch is not defined". Be sure to check your scripts for such references before building them into a flow.
2+
3+
You'll have to use [HTTP with Azure AD](/connectors/webcontents/) or other equivalent actions to pull data from or push it to an external service.
4+
5+
> [!WARNING]
6+
> External calls made through the Power Automate [Excel Online connector](/connectors/excelonlinebusiness) fail in order to help uphold existing data loss prevention policies. However, scripts that are run through Power Automate are done so outside of your organization, and outside of your organization's firewalls. For additional protection from malicious users in this external environment, your admin can control the use of Office Scripts. Your admin can either disable the Excel Online connector in Power Automate or turn off Office Scripts for Excel through the [Office Scripts administrator controls](/microsoft-365/admin/manage/manage-office-scripts-settings).

docs/includes/platform-requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
To use Office Scripts, you'll need the following.
22

33
1. Excel for Windows (version 2210 or higher), Excel for Mac, or Excel on the web.
4-
*The [Action Recorder](../overview/excel.md#action-recorder) is not yet available in the [Semi-Annual Enterprise Channel](/deployoffice/updates/overview-update-channels#semi-annual-enterprise-channel-overview).*
4+
- *The [Action Recorder](../overview/excel.md#action-recorder) is not yet available in the [Semi-Annual Enterprise Channel](/deployoffice/updates/overview-update-channels#semi-annual-enterprise-channel-overview).*
55
1. OneDrive for Business.
66
1. Any commercial or educational Microsoft 365 license with access to the Microsoft 365 Office desktop apps, such as:
77
- Office 365 Business

docs/resources/samples/add-image-to-workbook.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Add images to a workbook
33
description: Learn how to use Office Scripts to add an image to a workbook and copy it across sheets.
4-
ms.date: 07/12/2021
4+
ms.date: 04/20/2023
55
ms.localizationpriority: medium
66
---
77

@@ -49,6 +49,9 @@ function main(workbook: ExcelScript.Workbook)
4949

5050
## Sample code: Add an image from a URL to a workbook
5151

52+
> [IMPORTANT]
53+
> This sample won't work in Power Automate because of the [`fetch` call](../../develop/external-calls.md#external-calls-from-power-automate).
54+
5255
```TypeScript
5356
async function main(workbook: ExcelScript.Workbook) {
5457
// Fetch the image from a URL.

docs/testing/platform-limits.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Platform limits and requirements with Office Scripts
33
description: Resource limits and browser support for Office Scripts when used with Excel.
44
ms.topic: limits-and-quotas
5-
ms.date: 04/11/2023
5+
ms.date: 04/20/2023
66
ms.localizationpriority: medium
77
---
88

@@ -42,6 +42,22 @@ Additional Power Automate platform usage limitations can be found in the followi
4242
- [Limits and configuration in Power Automate](/power-automate/limits-and-config)
4343
- [Known issues and limitations for the Excel Online (Business) connector](/connectors/excelonlinebusiness/#known-issues-and-limitations)
4444

45+
## Power Automate specific restrictions
46+
47+
There are a few important differences between running a script in the Excel application and running a script as part of a Power Automate flow.
48+
49+
### No external calls from a script
50+
51+
[!INCLUDE [External calls in Power Automate](../includes/external-calls-power-automate.md)]
52+
53+
### API behavior differences
54+
55+
Some APIs behave differently when run with Power Automate. Others fail due to their reliance on the Excel UI. The full lists are found in [Troubleshoot Office Scripts running in Power Automate](power-automate-troubleshooting.md).
56+
57+
### ISO strict Open XML workbooks aren't supported
58+
59+
The **Excel Business (Online)** connector's **Run script** action doesn't support workbooks with the [ISO strict version of the Excel Workbook file format](https://www.loc.gov/preservation/digital/formats/fdd/fdd000401.shtml). Flows with this type of workbook return a "BadGateway" error when trying to run a script. This is due to coauthoring restrictions. Please save workbooks as the standard Excel Workbook format for use with Power Automate.
60+
4561
## Teams support
4662

4763
[!INCLUDE [Teams support note](../includes/teams-support-note.md)]

docs/testing/power-automate-troubleshooting.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Troubleshoot Office Scripts running in Power Automate
33
description: Tips, platform information, and known issues with the integration between Office Scripts and Power Automate.
44
ms.topic: troubleshooting-general
5-
ms.date: 03/27/2023
5+
ms.date: 04/20/2023
66
ms.localizationpriority: medium
77
---
88

@@ -32,6 +32,7 @@ The following methods throw an error and fail when called from a script in a Pow
3232
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `getActiveSlicer` |
3333
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `getSelectedRange` |
3434
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `getSelectedRanges` |
35+
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `refreshAllDataConnections` |
3536

3637
### Script methods with a default behavior in Power Automate flows
3738

@@ -42,9 +43,9 @@ The following methods use a default behavior, in lieu of any user's current stat
4243
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `getActiveWorksheet` | Returns either the first worksheet in the workbook or the worksheet currently activated by the `Worksheet.activate` method. |
4344
| [Worksheet](/javascript/api/office-scripts/excelscript/excelscript.worksheet) | `activate` | Marks the worksheet as the active worksheet for purposes of `Workbook.getActiveWorksheet`. |
4445

45-
## Data refresh not supported in Power Automate
46+
## PivotTable refresh not supported in Power Automate
4647

47-
Office Scripts can't refresh data when run in Power Automate. Methods such as `PivotTable.refresh` do nothing when called in a flow. Additionally, Power Automate doesn't trigger a data refresh for formulas that use workbook links.
48+
Office Scripts can't refresh data when run in Power Automate. PivotTable methods such as `PivotTable.refresh` do nothing when called in a flow. `Workbook.refreshAllDataConnections` throws an error. Additionally, Power Automate doesn't trigger a data refresh for formulas that use workbook links.
4849

4950
### Script methods that do nothing when run in Power Automate flows
5051

@@ -53,7 +54,6 @@ The following methods do nothing in a script when called through Power Automate.
5354
| Class | Method |
5455
|--|--|
5556
| [PivotTable](/javascript/api/office-scripts/excelscript/excelscript.pivottable) | `refresh` |
56-
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `refreshAllDataConnections` |
5757
| [Workbook](/javascript/api/office-scripts/excelscript/excelscript.workbook) | `refreshAllPivotTables` |
5858
| [Worksheet](/javascript/api/office-scripts/excelscript/excelscript.worksheet) | `refreshAllPivotTables` |
5959

@@ -86,10 +86,6 @@ There are two reasons that the parameters or returned data of a script are not a
8686

8787
The signature of a script is stored with the **Excel Business (Online)** connector when it is created. Remove the old connector and create a new one to get the latest parameters and return values for the **Run script** action.
8888

89-
## ISO strict Open XML workbooks aren't supported
90-
91-
The **Excel Business (Online)** connector's **Run script** action doesn't support workbooks with the [ISO strict version of the Excel Workbook file format](https://www.loc.gov/preservation/digital/formats/fdd/fdd000401.shtml). Flows with this type of workbook return a "BadGateway" error when trying to run a script. This is due to coauthoring restrictions. Please save workbooks as the standard Excel Workbook format for use with Power Automate.
92-
9389
## See also
9490

9591
- [Troubleshoot Office Scripts](troubleshooting.md)

0 commit comments

Comments
 (0)