You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/power-automate-integration.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Run Office Scripts with Power Automate
3
3
description: How to get Office Scripts for Excel working with a Power Automate workflow.
4
4
ms.topic: integration
5
-
ms.date: 08/10/2023
5
+
ms.date: 09/19/2023
6
6
ms.localizationpriority: medium
7
7
---
8
8
@@ -42,8 +42,11 @@ This opens a task pane with several options to begin connecting your Office Scri
42
42
> [!NOTE]
43
43
> The **Run script** Power Automate action only supports scripts stored in your OneDrive. To run scripts shared in SharePoint libraries, use the **Run script from SharePoint library (Preview)** action. This action is currently in preview and is subject to change based on feedback. If you encounter any issues with this action, please report them through the **Help** > **Give Feedback** option in Power Automate.
44
44
45
-
> [!IMPORTANT]
46
-
> The "Run script" action gives people who use the Excel connector significant access to your workbook and its data. Additionally, there are security risks with scripts that make external API calls, as explained in [External calls from Power Automate](external-calls.md). If your admin is concerned with the exposure of highly sensitive data, they can either turn off the Excel Online connector or restrict access to Office Scripts through the [Office Scripts administrator controls](/microsoft-365/admin/manage/manage-office-scripts-settings).
45
+
### Data security in Office Scripts with Power Automate
46
+
47
+
The "Run script" action gives people who use the Excel connector significant access to your workbook and its data. Additionally, there are security risks with scripts that make external API calls, as explained in [External calls from Power Automate](external-calls.md). If your admin is concerned with the exposure of highly sensitive data, they can either turn off the Excel Online connector or restrict access to Office Scripts through the [Office Scripts administrator controls](/microsoft-365/admin/manage/manage-office-scripts-settings).
48
+
49
+
For admins who have enabled Conditional Access policies for unmanaged devices in their tenant, it's a best practice to disable Power Automate on unmanaged devices. This process is detailed in the blog post [Control Access to Power Apps and Power Automate with Azure AD Conditional Access Policies](https://devblogs.microsoft.com/premier-developer/control-access-to-power-apps-and-power-automate-with-azure-ad-conditional-access-policies/).
Copy file name to clipboardExpand all lines: docs/resources/samples/data-validation-samples.md
+81-8Lines changed: 81 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,25 @@
1
1
---
2
-
title: Create a dropdown list using data validation
2
+
title: "Data validation: dropdown lists, prompts, and warning pop-ups"
3
3
description: Learn how to add data validation to a cell and give the user a selection of values to enter.
4
-
ms.date: 09/08/2023
4
+
ms.date: 09/20/2023
5
5
ms.localizationpriority: medium
6
6
---
7
7
8
-
# Create a dropdown list using data validation
8
+
# Data validation: dropdown lists, prompts, and warning pop-ups
9
9
10
-
This script creates a dropdown selection list for a cell. It uses the existing values of the selected range as the choices for the list.
10
+
Data validation helps the user ensure consistency in a worksheet. Use these features to limit what can be entered into a cell and provide warnings or errors to users when those conditions aren't met. To learn more about data validation in Excel, see [Apply data validation to cells](https://support.microsoft.com/office/29fecbcc-d1b9-42c1-9d76-eff3ce5f7249).
11
+
12
+
## Create a dropdown list using data validation
13
+
14
+
The following sample creates a dropdown selection list for a cell. It uses the existing values of the selected range as the choices for the list.
11
15
12
16
:::image type="content" source="../../images/sample-data-validation.png" alt-text="A worksheet showing a range of three cells containing color choices 'red, blue, green' and next to it, the same choices shown in a dropdown list.":::
13
17
14
18
```TypeScript
15
19
function main(workbook:ExcelScript.Workbook) {
16
20
// Get the values for data validation.
17
-
let selectedRange =workbook.getSelectedRange();
18
-
let rangeValues =selectedRange.getValues();
21
+
const selectedRange =workbook.getSelectedRange();
22
+
const rangeValues =selectedRange.getValues();
19
23
20
24
// Convert the values into a comma-delimited string.
21
25
let dataValidationListString ="";
@@ -29,8 +33,8 @@ function main(workbook: ExcelScript.Workbook) {
@@ -41,3 +45,72 @@ function main(workbook: ExcelScript.Workbook) {
41
45
});
42
46
}
43
47
```
48
+
49
+
## Add a prompt to a range
50
+
51
+
This example creates a prompt note that appears when a user enters the given cells. This is used to remind users about input requirements, without strict enforcement.
52
+
53
+
:::image type="content" source="../../images/data-validation-prompt.png" alt-text="A prompt with the title 'First names only' and the message 'Only enter the first name of the employee, not the full name.' next to a worksheet with some names in cells.":::
54
+
55
+
```TypeScript
56
+
/**
57
+
* This script creates a text prompt that's shown in C2:C8 when a user enters the cell.
58
+
*/
59
+
function main(workbook:ExcelScript.Workbook) {
60
+
// Get the data validation object for C2:C8 in the current worksheet.
// Clear any previous validation to avoid conflicts.
65
+
dataValidation.clear();
66
+
67
+
// Create a prompt to remind users to only enter first names in this column.
68
+
const prompt:ExcelScript.DataValidationPrompt= {
69
+
showPrompt: true,
70
+
title: "First names only",
71
+
message: "Only enter the first name of the employee, not the full name."
72
+
}
73
+
dataValidation.setPrompt(prompt);
74
+
}
75
+
```
76
+
77
+
## Alert the user when invalid data is entered
78
+
79
+
The following sample script prevents the user from entering anything other than positive numbers into a range. If they try to put anything else, an error message pops up and indicates the problem.
80
+
81
+
:::image type="content" source="../../images/data-validation-error.png" alt-text="An error message with the title 'Invalid data' and the message 'Positive numbers only.' next to a cell with a negative number.":::
82
+
83
+
```TypeScript
84
+
/**
85
+
* This script creates a data validation rule for the range B2:B5.
86
+
* All values in that range must be a positive number.
87
+
* Attempts to enter other values are blocked and an error message appears.
Copy file name to clipboardExpand all lines: docs/resources/samples/samples-overview.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Office Scripts samples
3
3
description: Available Office Scripts samples and scenarios.
4
-
ms.date: 09/08/2023
4
+
ms.date: 09/20/2023
5
5
ms.localizationpriority: medium
6
6
---
7
7
@@ -26,6 +26,7 @@ This section contains [Office Scripts](../../overview/excel.md) based solutions
26
26
|[Add comments in Excel](add-excel-comments.md)| This sample adds comments to a cell including @mentioning a colleague. |
27
27
|[Add images to a workbook](add-image-to-workbook.md)| This sample adds an image to a workbook and copies an image across sheets.|
28
28
|[Copy multiple Excel tables into a single table](copy-tables-combine.md)| This sample combines data from multiple Excel tables into a single table that includes all the rows. |
29
+
|[Data validation: dropdown lists, prompts, and warning pop-ups](data-validation-samples.md)| These samples show how to use data validation to mandate specific conditions for cell data and how the user is alerted to these rules. |
29
30
|[Create a workbook table of contents](table-of-contents.md)| This sample creates a table of contents with links to each worksheet. |
30
31
|[JavaScript `Date` samples](javascript-dates.md)| A collection of samples that show how to translate between JavaScript and Excel date formats. |
31
32
|[Record day-to-day changes in Excel and report them with a Power Automate flow](report-day-to-day-changes.md)| This sample uses a scheduled Power Automate flow to record daily readings and report the changes. |
Copy file name to clipboardExpand all lines: docs/testing/platform-limits.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Platform limits and requirements with Office Scripts
3
3
description: Resource limits and browser support for Office Scripts when used with Excel.
4
4
ms.topic: limits-and-quotas
5
-
ms.date: 09/08/2023
5
+
ms.date: 09/19/2023
6
6
ms.localizationpriority: medium
7
7
---
8
8
@@ -78,13 +78,16 @@ Your browser needs third-party cookies enabled to show the **Automate** tab in E
78
78
79
79
## Conditional Access
80
80
81
-
[Conditional Access](/azure/active-directory/conditional-access/overview) policies can restrict access to SharePoint and OneDrive for [unmanaged devices](/sharepoint/control-access-from-unmanaged-devices). If your device isn't managed by the tenant, you may not have access to specific scripts, or may only be able to access them through the browser.
81
+
[Conditional Access](/azure/active-directory/conditional-access/overview) policies restrict access to SharePoint and OneDrive for [unmanaged devices](/sharepoint/control-access-from-unmanaged-devices). If your device isn't managed by the tenant, you may not have access to specific scripts, or may only be able to access them through the browser.
82
82
83
83
If you script is blocked by Conditional Access policies, you'll receive one of two error messages. These messages also surface in Power Automate if your flow is run from an unmanaged device.
84
84
85
85
- "Due to organizational policies, you can’t access this resource from this untrusted device."
86
86
- "We can't find this script. It may have been deleted by another user." (If your version of Excel is older.)
87
87
88
+
> [!IMPORTANT]
89
+
> Administrators should consider blocking all access to Power Automate from unmanaged devices. This process is detailed in the blog post [Control Access to Power Apps and Power Automate with Azure AD Conditional Access Policies](https://devblogs.microsoft.com/premier-developer/control-access-to-power-apps-and-power-automate-with-azure-ad-conditional-access-policies/).
90
+
88
91
## API support on older Excel versions
89
92
90
93
Some Office Scripts APIs may not be supported by Excel for Windows or Excel for Mac, especially older builds. These include newer APIs and APIs for web-only features. If a script contains unsupported APIs, the Code Editor displays a warning. If you try to run such a script, it won't run. Instead, the **Script Run Status** task pane displays a warning message that says, "This script currently must be run on Excel for the web. Open the workbook in the browser then try again, or contact the script owner for help."
0 commit comments