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/docs-ref-autogen/overview.md
+5-1Lines changed: 5 additions & 1 deletion
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: Office Scripts API reference
3
3
description: An overview of the Office Scripts JavaScript APIs.
4
4
ms.topic: overview
5
-
ms.date: 10/01/2022
5
+
ms.date: 12/04/2025
6
6
---
7
7
8
8
# Office Scripts API reference
@@ -12,6 +12,10 @@ The Office Scripts API lets you automate common tasks in Excel. Use this referen
12
12
> [!NOTE]
13
13
> If you're looking for the JavaScript APIs for developing Office Add-ins, visit the [Office Add-ins JavaScript API reference](/javascript/api/overview?view=excel-js-preview&preserve-view=true).
14
14
15
+
## Namespaces
16
+
17
+
Office Scripts APIs use two namespaces: [OfficeScript](/javascript/api/office-scripts/officescript) for APIs that are not connected to an Excel workbook, and [ExcelScript](/javascript/api/office-scripts/excelscript) for APIs that work with Excel workbooks.
18
+
15
19
## Common classes
16
20
17
21
The following list breaks down the basics of the Office Scripts object model. This shows the common classes and how they relate to one another.
Copy file name to clipboardExpand all lines: docs/docs-ref-autogen/preview-apis.md
+5-12Lines changed: 5 additions & 12 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: Office Scripts preview APIs
3
3
description: Details about upcoming Office Scripts APIs.
4
4
ms.topic: whats-new
5
-
ms.date: 09/12/2025
5
+
ms.date: 12/04/2025
6
6
---
7
7
8
8
# Office Scripts preview APIs
@@ -12,19 +12,12 @@ New Office Scripts APIs are first introduced in "preview", and then later releas
12
12
> [!IMPORTANT]
13
13
> Preview APIs are subject to change and are not intended for use in a production environment. We recommend that you try them out in test and development environments only. Do not use preview APIs in a production environment or within business-critical documents.
14
14
15
-
The following table provides a concise summary of the APIs, while the subsequent [API list](#api-list) section gives a detailed list.
16
-
17
-
| Feature area | Description | Relevant objects |
18
-
|:--- |:--- |:--- |
19
-
| Save and email a PDF | Save a worksheet as a PDF and email it to yourself or your team. For a sample, see [Save a worksheet and email it as a PDF](/office/dev/scripts/resources/samples/save-as-pdf-email-as-pdf). |[EmailAttachment](/javascript/api/office-scripts/officescript/officescript.emailattachment), [MailProperties](/javascript/api/office-scripts/officescript/officescript.mailproperties)|
20
-
21
15
## API list
22
16
23
-
Office Scripts APIs use two namespaces: `OfficeScript` for APIs that are not connected to an Excel workbook, and `ExcelScript` for APIs that work with Excel workbooks. Currently, the only preview APIs are in the `OfficeScript` namespace. The following section lists those APIs.
* Returns a range object that includes the current range and up to the edge of the range, based on the provided direction. This matches the <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Arrow key</kbd> behavior in the Excel on Windows UI.
1889
+
* Returns a range object that includes the current range and up to the edge of the range, based on the provided direction. This matches the Ctrl+Shift+Arrow key behavior in the Excel on Windows UI.
1890
1890
* @param direction The direction from the active cell.
1891
1891
* @param activeCell The active cell in this range. By default, the active cell is the top-left cell of the range. An error is thrown if the active cell is not in this range.
* Returns a range object that is the edge cell of the data region that corresponds to the provided direction. This matches the <kbd>Ctrl</kbd>+<kbd>Arrow key</kbd> behavior in the Excel on Windows UI.
1949
+
* Returns a range object that is the edge cell of the data region that corresponds to the provided direction. This matches the Ctrl+Arrow key behavior in the Excel on Windows UI.
1950
1950
* @param direction The direction from the active cell.
1951
1951
* @param activeCell The active cell in this range. By default, the active cell is the top-left cell of the range. An error is thrown if the active cell is not in this range.
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15264
15261
*/
15265
-
exportinterfaceFileProperties{
15262
+
exportinterfaceDownloadFileProperties{
15266
15263
/**
15267
15264
* The name of the file once downloaded. The file extension determines the type of the file. Supported extensions are ".txt" and ".pdf". Default is ".txt".
15268
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15269
15265
*/
15270
15266
name: string;
15271
15267
15272
15268
/**
15273
15269
* The content of the file.
15274
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15275
15270
*/
15276
15271
content: string;
15277
15272
}
15278
15273
15279
15274
/**
15280
15275
* Send an email with an Office Script. Use `MailProperties` to specify the content and recipients of the email.
15281
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15282
15276
* @param message The properties that define the content and recipients of the email.
15283
-
* @throwsSendMailErrorMaxCalls The error thrown if the maximum number of API calls is exceeded. The limit is 100 API calls.
15284
-
* @throws SendMailNoRecipient The error thrown if no recipient is specified.
15285
-
* @throws SendMailInvalidEmail The error thrown if an invalid email address is provided.
15286
-
* @throws SendMailExtensionNotSupported The error thrown if the attachment name extension is not ".txt" or ".pdf".
15287
-
* @throws ExternalApiTimeout The error thrown if the API reaches the timeout limit of 30 seconds.
15277
+
* @throws`SendMailMaxCalls` Thrown if the maximum number of API calls is exceeded. The limit is 100 API calls.
15278
+
* @throws`SendMailNoRecipient` Thrown if no recipient is specified.
15279
+
* @throws`SendMailInvalidEmail` Thrown if an invalid email address is provided.
15280
+
* @throws`SendMailExtensionNotSupported` Thrown if the attachment name extension is not ".txt" or ".pdf".
15281
+
* @throws`ExternalApiTimeout` Thrown if the API reaches the timeout limit of 30 seconds.
* A value must be specified for at least one of the `to`, `cc`, or `bcc` parameters.
15336
15323
* If no recipient is specified, the following error is shown: "The message has no recipient. Please enter a value for at least one of the "to", "cc", or "bcc" parameters."
15337
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15338
15324
*/
15339
15325
exportinterfaceEmailAttachment{
15340
15326
/**
15341
15327
* The text that is displayed below the icon representing the attachment. This string doesn't need to match the file name.
15342
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15343
15328
*/
15344
15329
name: string;
15345
15330
/**
15346
15331
* The contents of the file.
15347
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15348
15332
*/
15349
15333
content: string;
15350
15334
}
15351
15335
15352
15336
/**
15353
15337
* The properties of the email to be sent.
15354
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15355
15338
*/
15356
15339
exportinterfaceMailProperties{
15357
15340
/**
15358
15341
* The subject of the email. Optional.
15359
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15360
15342
*/
15361
15343
subject?: string;
15362
15344
15363
15345
/**
15364
15346
* The content of the email. Optional.
15365
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15366
15347
*/
15367
15348
content?: string;
15368
15349
15369
15350
/**
15370
15351
* The type of the content in the email. Possible values are text or HTML. Optional.
15371
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15372
15352
*/
15373
15353
contentType?: EmailContentType;
15374
15354
15375
15355
/**
15376
15356
* The importance of the email. The possible values are `low`, `normal`, and `high`. Default value is `normal`. Optional.
15377
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15378
15357
*/
15379
15358
importance?: EmailImportance;
15380
15359
15381
15360
/**
15382
15361
* The direct recipient or recipients of the email. Optional.
15383
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15384
15362
*/
15385
15363
to?: string|string[];
15386
15364
15387
15365
/**
15388
15366
* The carbon copy (CC) recipient or recipients of the email. Optional.
15389
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15390
15367
*/
15391
15368
cc?: string|string[];
15392
15369
15393
15370
/**
15394
15371
* The blind carbon copy (BCC) recipient or recipients of the email. Optional.
15395
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15396
15372
*/
15397
15373
bcc?: string|string[];
15398
15374
15399
15375
/**
15400
15376
* A file (such as a text file or Excel workbook) attached to a message. Optional.
15401
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15402
15377
*/
15403
15378
attachments?: EmailAttachment|EmailAttachment[];
15404
15379
}
15405
15380
15406
15381
/**
15407
15382
* Metadata about the script.
15408
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
15409
15383
*/
15410
15384
namespaceMetadata{
15411
15385
/**
15412
15386
* Get the name of the currently running script.
15413
-
* @beta This API is in preview and may change based on feedback. Do not use this API in a production environment.
0 commit comments