Skip to content

Commit 852c79b

Browse files
authored
Merge pull request #737 from OfficeDev/main
[admin] Publish
2 parents 1cc5471 + ee5cc72 commit 852c79b

File tree

5 files changed

+52
-7
lines changed

5 files changed

+52
-7
lines changed

.openpublishing.redirection.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"source_path": "docs/resources/samples/filter-table-get-visible-range.md",
25-
"redirect_url": "/office/dev/scripts/resources/samples/samples-overview"
25+
"redirect_url": "/office/dev/scripts/resources/samples/table-samples"
2626
},
2727
{
2828
"source_path": "docs/resources/samples/range-basics.md",

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at
1414

1515
If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
1616

17-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
17+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
1818

1919
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
2020

@@ -24,7 +24,7 @@ Please include the requested information listed below (as much as you can provid
2424
* Any special configuration required to reproduce the issue
2525
* Step-by-step instructions to reproduce the issue
2626
* Proof-of-concept or exploit code (if possible)
27-
* Impact of the issue, including how an attacker might exploit the issue
27+
* Impact of the issue, including how a threat actor might exploit the issue
2828

2929
This information will help us triage your report more quickly.
3030

docs/develop/pivottables.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Work with PivotTables in Office Scripts
33
description: Learn about the object model for PivotTables in the Office Scripts JavaScript API.
4-
ms.date: 10/19/2023
4+
ms.date: 04/18/2024
55
ms.localizationpriority: medium
66
---
77

@@ -179,6 +179,51 @@ The following code snippet adds a slicer for the "Type" field. It sets the selec
179179

180180
:::image type="content" source="../images/slicer.png" alt-text="A slicer filtering data on a PivotTable.":::
181181

182+
### Value field settings for summaries
183+
184+
Change how the PivotTable summarizes and displays data with these settings. The field in each data hierarchy can display the data in different ways, such as percentages, standard deviations, and relative comparisons.
185+
186+
#### Summarize by
187+
188+
The default summarization of a data hierarchy field is as a sum. `DataPivotHierarchy.setSummarizeBy` lets you combine the data for each row or column in a different way. [`AggregationFunction`](/javascript/api/office-scripts/excelscript/excelscript.aggregationfunction) lists the all the available options.
189+
190+
The following code snippet changes "Crates Sold Wholesale" to show each item's standard deviation, instead of the sum.
191+
192+
```typescript
193+
const wholesaleSales = farmPivot.getDataHierarchy("Sum of Crates Sold Wholesale");
194+
wholesaleSales.setSummarizeBy(ExcelScript.AggregationFunction.standardDeviation);
195+
```
196+
197+
#### Show values as
198+
199+
`DataPivotHierarchy.setShowAs` applies a calculation to the values of a data hierarchy. Instead of the default sum, you can show values or percentages relative to other parts of the PivotTable. Use a [`ShowAsRule`](/javascript/api/office-scripts/excelscript/excelscript.showasrule) to set how data hierarchy values are shown.
200+
201+
The following code snippet changes the display for "Crates Sold at Farm". The values will be shown as a percentage of the grand total for the field.
202+
203+
```typescript
204+
const farmSales = farmPivot.getDataHierarchy("Sum of Crates Sold at Farm");
205+
206+
const rule : ExcelScript.ShowAsRule = {
207+
calculation: ExcelScript.ShowAsCalculation.percentOfGrandTotal
208+
};
209+
farmSales.setShowAs(rule);
210+
```
211+
212+
Some `ShowAsRule`s need another field or item in that field as a comparison. The following code snippet again changes the display for "Crates Sold at Farm". This time, the field will show each value's difference from the value of the "Lemons" in that farm row. If a farm has not sold any lemons, the field shows "#N/A".
213+
214+
```typescript
215+
const typeField = farmPivot.getRowHierarchy("Type").getFields()[0];
216+
const farmSales = farmPivot.getDataHierarchy("Sum of Crates Sold at Farm");
217+
218+
const rule: ExcelScript.ShowAsRule = {
219+
calculation: ExcelScript.ShowAsCalculation.differenceFrom,
220+
baseField: typeField, /* The field to use for the difference. */
221+
baseItem: typeField.getPivotItem("Lemon") /* The item within that field that is the basis of comparison for the difference. */
222+
};
223+
farmSales.setShowAs(rule);
224+
farmSales.setName("Difference from Lemons of Crates Sold at Farm");
225+
```
226+
182227
## See also
183228

184229
- [Fundamentals for Office Scripts in Excel](scripting-fundamentals.md)

docs/includes/platform-requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ To use Office Scripts, you'll need the following.
22

33
# [For business and education](#tab/business)
44

5-
1. Excel for Windows (version 2210 or higher), Excel for Mac, or Excel on the web.
5+
1. Excel on the web, Excel for Windows (Version 2210 or higher), or Excel for Mac.
66
1. OneDrive for Business.
77
1. Any commercial or educational Microsoft 365 license with access to the Microsoft 365 Office desktop apps, such as:
88
- Office 365 Business
@@ -22,7 +22,7 @@ To use Office Scripts, you'll need the following.
2222
> [!IMPORTANT]
2323
> Office Scripts is in preview for personal and family Microsoft 365 subscriptions. If you encounter any issues, please report them through the Feedback button in Excel.
2424
25-
1. Excel for Microsoft 365 or Excel on the web.
25+
1. Excel on the web or Excel for Microsoft 365.
2626
1. Join the [Microsoft 365 Insider program](https://insider.microsoft365.com/join/windows).
2727
1. Internet connectivity with [connected experiences](/deployoffice/privacy/connected-experiences) enabled.
2828

docs/resources/power-query-differences.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Power Query is used in the [SQL Server](https://powerquery.microsoft.com/flow/)
4444

4545
## Platform dependencies
4646

47-
Office Scripts is currently available for Excel for Windows, for Mac, and on the web. The full Power Query experience is currently [only available for Excel for Windows](/power-query/power-query-what-is-power-query#where-can-you-use-power-query). Both can be used through Power Automate, which lets the flow work with Excel workbooks stored in OneDrive.
47+
Office Scripts is currently available for Excel on the web, Excel for Windows, and Excel for Mac. The full Power Query experience is currently [only available for Excel for Windows](/power-query/power-query-what-is-power-query#where-can-you-use-power-query). Both can be used through Power Automate, which lets the flow work with Excel workbooks stored in OneDrive.
4848

4949
## See also
5050

0 commit comments

Comments
 (0)