diff --git a/.gitignore b/.gitignore index c2c1e686..dd50b03d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ _themes*/ _repo.*/ .vscode/ -.openpublishing.buildcore.ps1 \ No newline at end of file +.openpublishing.buildcore.ps1 +*DS_Store \ No newline at end of file diff --git a/docs/develop/script-buttons.md b/docs/develop/script-buttons.md index 0dec895d..5c429ed4 100644 --- a/docs/develop/script-buttons.md +++ b/docs/develop/script-buttons.md @@ -2,7 +2,7 @@ title: Run Office Scripts in Excel from buttons description: Add buttons to workbooks that control Office Scripts in Excel. ms.topic: overview -ms.date: 06/06/2024 +ms.date: 02/26/2026 ms.localizationpriority: medium --- @@ -17,18 +17,21 @@ Help your colleagues find and run your scripts by adding script buttons to a wor ## Create script buttons -When viewing a script, select **Add in workbook**. This creates a button in the workbook that runs the associated script. It also shares the script with the workbook, so everyone with write permissions to the workbook can use your helpful automation. +When viewing a script, scroll to the **Share this script** section and enable the **Associate with workbook** toggle. This shares the script with the workbook, so everyone with write permissions to the workbook can use your helpful automation. Select **Add button to worksheet** to create a button in the worksheet that runs the associated script. -:::image type="content" source="../images/add-button.png" alt-text="The 'Add in workbook' button on the 'Create Report' script details page with a button named 'Create Report' shown in the Excel grid."::: +:::image type="content" source="../images/add-button.png" alt-text="The 'Associate with workbook' and 'Add button to worksheet' controls in the Share this script section."::: > [!IMPORTANT] -> If OneDrive sharing is restricted by organizational policies, you can't create a script button. +> If OneDrive sharing is restricted by organizational policies, you can't associate a script or create a script button. ## Remove script buttons -To stop sharing a script through a button, select the arrow next to **Add in workbook** and choose the option **Remove from workbook**. This removes all the buttons that run the script. Deleting a single button removes the script from that one button, even if the operation is undone or the button is cut and pasted. +To stop sharing a script, disable the **Associate with workbook** toggle in the **Share this script** section of the script details page. This removes all the buttons that run the script from the workbook. -:::image type="content" source="../images/remove-button.png" alt-text="The 'Remove from workbook' option on the script details page."::: +:::image type="content" source="../images/associate-with-workbook.png" alt-text="The 'Share this script' section of the script details page, with the 'Associate with workbook' toggle enabled."::: + +> [!IMPORTANT] +> Deleting a script button from the Excel grid removes that button, but the script still remains associated with the workbook. ## Older versions of Excel diff --git a/docs/develop/typescript-restrictions.md b/docs/develop/typescript-restrictions.md index e3163845..11150f8e 100644 --- a/docs/develop/typescript-restrictions.md +++ b/docs/develop/typescript-restrictions.md @@ -1,13 +1,13 @@ --- title: TypeScript restrictions in Office Scripts -description: The specifics of the TypeScript compiler and linter used by the Office Scripts Code Editor. -ms.date: 11/21/2025 +description: The specifics of the TypeScript compiler and linter used by the Office Scripts code editor. +ms.date: 02/26/2026 ms.localizationpriority: medium --- # TypeScript restrictions in Office Scripts -Office Scripts use the TypeScript language. For the most part, any TypeScript or JavaScript code will work in Office Scripts. However, there are a few restrictions enforced by the Code Editor to ensure your script works consistently and as intended with your Excel workbook. +Office Scripts use the TypeScript language. For the most part, any TypeScript or JavaScript code will work in Office Scripts. However, there are a few restrictions enforced by the code editor to ensure your script works consistently and as intended with your Excel workbook. > [!NOTE] > Office Scripts uses TypeScript version 4.0.3. TypeScript features added in subsequent versions are not supported in Office Scripts. @@ -20,11 +20,11 @@ Writing [types](https://www.typescriptlang.org/docs/handbook/typescript-in-5-min You cannot explicitly declare a variable to be of type `any` in Office Scripts (that is, `let value: any;`). The `any` type causes issues when processed by Excel. For example, a `Range` needs to know that a value is a `string`, `number`, or `boolean`. You will receive a compile-time error (an error prior to running the script) if any variable is explicitly defined as the `any` type in the script. -:::image type="content" source="../images/explicit-any-editor-message.png" alt-text="The explicit `any` message in the Code Editor's hover text."::: +:::image type="content" source="../images/explicit-any-editor-message.png" alt-text="The explicit `any` message in the code editor's hover text."::: :::image type="content" source="../images/explicit-any-error-message.png" alt-text="The explicit `any` error in the console window."::: -In the previous screenshot, `[2, 14] Explicit Any is not allowed` indicates that line #2, column #14 defines `any` type. This helps you locate the error. +In the previous screenshot, `[6, 14] Explicit Any is not allowed` indicates that line #6, column #14 defines `any` type. This helps you locate the error. To get around this issue, always define the type of the variable. If you are uncertain about the type of a variable, you can use a [union type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types). This can be useful for variables that hold `Range` values, which can be of type `string`, `number`, or `boolean` (the type for `Range` values is a union of those: `string | number | boolean`). @@ -32,7 +32,7 @@ To get around this issue, always define the type of the variable. If you are unc TypeScript variable types can be [implicitly](https://www.typescriptlang.org/docs/handbook/type-inference.html) defined. If the TypeScript compiler is unable to determine the type of a variable (either because type is not defined explicitly or type inference isn't possible), then it's an implicit `any` and you will receive a compilation-time error. -:::image type="content" source="../images/implicit-any-editor-message.png" alt-text="The implicit `any` message in the Code Editor's hover text."::: +:::image type="content" source="../images/implicit-any-editor-message.png" alt-text="The implicit `any` message in the code editor's hover text."::: The most common case on any implicit `any` is in a variable declaration, such as `let value;`. There are two ways to avoid this: @@ -72,7 +72,7 @@ let filteredArray = myArray.filter((x) => { return x % 2 === 0; }); /* - The following code generates a compiler error in the Office Scripts Code Editor. + The following code generates a compiler error in the Office Scripts code editor. filteredArray = myArray.filter(function (x) { return x % 2 === 0; }); @@ -125,7 +125,7 @@ function main(workbook: ExcelScript.Workbook) { ## Performance warnings -The Code Editor's [linter](https://wikipedia.org/wiki/Lint_(software)) gives warnings if the script might have performance issues. The cases and how to work around them are documented in [Improve the performance of your Office Scripts](web-client-performance.md). +The code editor [linter](https://wikipedia.org/wiki/Lint_(software)) gives warnings if the script might have performance issues. The cases and how to work around them are documented in [Improve the performance of your Office Scripts](web-client-performance.md). ## External API calls diff --git a/docs/images/action-recorder-copy-code.png b/docs/images/action-recorder-copy-code.png index bf93c11f..6c746939 100644 Binary files a/docs/images/action-recorder-copy-code.png and b/docs/images/action-recorder-copy-code.png differ diff --git a/docs/images/action-recorder-intro.png b/docs/images/action-recorder-intro.png index 2e1cf2d5..91977bad 100644 Binary files a/docs/images/action-recorder-intro.png and b/docs/images/action-recorder-intro.png differ diff --git a/docs/images/add-button.png b/docs/images/add-button.png index 351a497d..ceb48204 100644 Binary files a/docs/images/add-button.png and b/docs/images/add-button.png differ diff --git a/docs/images/associate-with-workbook.png b/docs/images/associate-with-workbook.png new file mode 100644 index 00000000..7e4d95c2 Binary files /dev/null and b/docs/images/associate-with-workbook.png differ diff --git a/docs/images/code-editor-intro.png b/docs/images/code-editor-intro.png index f267f940..e3cbe7a1 100644 Binary files a/docs/images/code-editor-intro.png and b/docs/images/code-editor-intro.png differ diff --git a/docs/images/explicit-any-editor-message.png b/docs/images/explicit-any-editor-message.png index e8ec39ee..cd05f745 100644 Binary files a/docs/images/explicit-any-editor-message.png and b/docs/images/explicit-any-editor-message.png differ diff --git a/docs/images/explicit-any-error-message.png b/docs/images/explicit-any-error-message.png index 9a7ed55e..472b979d 100644 Binary files a/docs/images/explicit-any-error-message.png and b/docs/images/explicit-any-error-message.png differ diff --git a/docs/images/implicit-any-editor-message.png b/docs/images/implicit-any-editor-message.png index 9548e39c..40b38c99 100644 Binary files a/docs/images/implicit-any-editor-message.png and b/docs/images/implicit-any-editor-message.png differ diff --git a/docs/images/runtime-error-console.png b/docs/images/runtime-error-console.png index 72d823e4..1ba6c78e 100644 Binary files a/docs/images/runtime-error-console.png and b/docs/images/runtime-error-console.png differ diff --git a/docs/images/share-this-script.png b/docs/images/share-this-script.png new file mode 100644 index 00000000..ef5c107c Binary files /dev/null and b/docs/images/share-this-script.png differ diff --git a/docs/overview/code-editor-environment.md b/docs/overview/code-editor-environment.md index 5cb44c8a..5afb0a37 100644 --- a/docs/overview/code-editor-environment.md +++ b/docs/overview/code-editor-environment.md @@ -1,19 +1,19 @@ --- -title: Office Scripts Code Editor environment -description: The prerequisites and environment information for Office Scripts in Excel. -ms.date: 11/01/2023 +title: Office Scripts code editor +description: Learn about the Office Scripts code editor and scripting environment in Excel, including prerequisites and supported APIs. +ms.date: 02/06/2026 ms.localizationpriority: medium --- -# Office Scripts Code Editor environment +# Office Scripts code editor -Office Scripts are written in either TypeScript or JavaScript and use the Office Scripts JavaScript APIs to interact with an Excel workbook. The Code Editor is based on Visual Studio Code, so if you've used that environment before, you'll feel right at home. +Office Scripts are written in either TypeScript or JavaScript and use the Office Scripts JavaScript APIs to interact with an Excel workbook. The Office Scripts code editor is based on Visual Studio Code, so if you've used that environment before, you'll feel right at home. ## Scripting language: TypeScript or JavaScript -Office Scripts are written in [TypeScript](https://www.typescriptlang.org/docs), which is a superset of [JavaScript](https://developer.mozilla.org/docs/Web/JavaScript). The Action Recorder generates code in TypeScript and the Office Scripts documentation uses TypeScript. Since TypeScript is a superset of JavaScript, any scripting code that you write in JavaScript will work just fine. +Office Scripts are written in [TypeScript](https://www.typescriptlang.org/docs), which is a superset of [JavaScript](https://developer.mozilla.org/docs/Web/JavaScript). The action recorder generates code in TypeScript and the Office Scripts documentation uses TypeScript. Since TypeScript is a superset of JavaScript, any scripting code that you write in JavaScript will work just fine. -Office Scripts are largely self-contained pieces of code. Only a small part of TypeScript's functionality is used. Therefore, you can edit scripts without having to learn the intricacies of TypeScript. The Code Editor also handles the installation, compilation, and execution of code, so you don't need to worry about anything but the script itself. It's possible to learn the language and create scripts without previous programming knowledge. However, if you're new to programming, we recommend learning some fundamentals before proceeding with Office Scripts. +Office Scripts are largely self-contained pieces of code. Only a small part of TypeScript's functionality is used. Therefore, you can edit scripts without having to learn the intricacies of TypeScript. The code editor also handles the installation, compilation, and execution of code, so you don't need to worry about anything but the script itself. It's possible to learn the language and create scripts without previous programming knowledge. However, if you're new to programming, we recommend learning some fundamentals before proceeding with Office Scripts. [!INCLUDE [Recommended coding resources](../includes/coding-basics-references.md)] @@ -27,19 +27,19 @@ Office Scripts does not support the usage of external, third-party JavaScript li ## IntelliSense -IntelliSense is a set of Code Editor features that help you write code. It provides auto-complete, syntax error highlighting, and inline API documentation. +IntelliSense is a set of code editor features that help you write code. It provides auto-complete, syntax error highlighting, and inline API documentation. -IntelliSense gives suggestions as you type, similar to the suggested text in Excel. Pressing the Tab or Enter key inserts the suggested member. Trigger IntelliSense at the current cursor location by pressing the Ctrl+Space keys. These suggestions are especially useful when completing a method. The method signature displayed by IntelliSense contains a list of arguments it needs, each argument's type, whether a given argument is required or optional, and the return type of the method. +IntelliSense gives suggestions as you type, similar to the suggested text in Excel. Using the Tab or Enter key inserts the suggested member. Trigger IntelliSense at the current cursor location with the Ctrl+Space keys. These suggestions are especially useful when completing a method. The method signature displayed by IntelliSense contains a list of arguments it needs, each argument's type, whether a given argument is required or optional, and the return type of the method. Hover the cursor over a method, class, or other code object to see more information. Hover over a syntax error or code suggestion, represented by a red or yellow squiggly line, to see suggestions on how to fix the problem. Often, IntelliSense provides a "Quick Fix" option to automatically change the code. -:::image type="content" source="../images/implicit-any-editor-message.png" alt-text="An error message in the Code Editor's hover text with a 'Quick Fix' button."::: +:::image type="content" source="../images/implicit-any-editor-message.png" alt-text="An error message in the code editor's hover text with a 'Quick Fix' button."::: -The Office Scripts Code Editor uses the same IntelliSense engine as Visual Studio Code. To learn more about the feature, visit [Visual Studio Code's IntelliSense Features](https://code.visualstudio.com/docs/editor/intellisense#_intellisense-features). +The Office Scripts code editor uses the same IntelliSense engine as Visual Studio Code. To learn more about the feature, visit [Visual Studio Code's IntelliSense Features](https://code.visualstudio.com/docs/editor/intellisense#_intellisense-features). ## Keyboard shortcuts -Most of the keyboard shortcuts for Visual Studio Code also work in the Office Scripts Code Editor. Use the following PDFs to learn about the available options and get the most out of the Code Editor: +Most of the keyboard shortcuts for Visual Studio Code also work in the Office Scripts code editor. Use the following PDFs to learn about the available options and get the most out of the code editor: - [Keyboard shortcuts for macOS](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf). - [Keyboard shortcuts for Windows](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf). diff --git a/docs/overview/excel.md b/docs/overview/excel.md index 3958e163..55ea35c3 100644 --- a/docs/overview/excel.md +++ b/docs/overview/excel.md @@ -1,16 +1,16 @@ --- title: Office Scripts in Excel -description: A brief introduction to the Action Recorder and Code Editor for Office Scripts. +description: A brief introduction to the action recorder and code editor for Office Scripts. ms.topic: overview -ms.date: 08/08/2024 +ms.date: 02/26/2026 ms.localizationpriority: high --- # Office Scripts in Excel -Office Scripts in Excel let you automate your day-to-day tasks. Use the Action Recorder to turn manual steps into reusable scripts. Edit those scripts or create new ones with the Code Editor. Let others in the workbook run these scripts with a single button. Then, share them with coworkers so everyone can improve their workflow. +Office Scripts in Excel let you automate your day-to-day tasks. Use the action recorder to turn manual steps into reusable scripts. Edit those scripts or create new ones with the code editor. Let others in the workbook run these scripts with a single button. Then, share them with coworkers so everyone can improve their workflow. -This series of documents teaches you how to use these tools. You'll find a wealth of samples covering different Excel scenarios. Use the tutorials to introduce yourself to the Action Recorder and Code Editor. These provide step-by-step guidance on how to record your frequent Excel actions, edit those scripts, and create new scripts from scratch. +This series of documents teaches you how to use these tools. You'll find a wealth of samples covering different Excel scenarios. Use the tutorials to introduce yourself to the action recorder and code editor. These provide step-by-step guidance on how to record your frequent Excel actions, edit those scripts, and create new scripts from scratch.
@@ -20,36 +20,36 @@ This series of documents teaches you how to use these tools. You'll find a wealt Scripts allow you to record and replay your Excel actions on different workbooks and worksheets. If you find yourself doing the same things over and over again, you can turn all that work into an easy-to-run Office Script. Run your script with a button in Excel or combine it with Power Automate to streamline your entire workflow. -As an example, imagine at the start of each work day you open a .csv file from an accounting site in Excel. You then spend several minutes deleting unnecessary columns, formatting a table, adding formulas, and creating a PivotTable in a new worksheet. Those actions you repeat daily can be recorded once with the Action Recorder. From then on, running the script will take care of your entire .csv conversion. You'll not only remove the risk of forgetting steps, but be able to share your process with others without having to teach them anything. Office Scripts allows you to automate your common tasks so you and your workplace can be more efficient and productive. +As an example, imagine at the start of each work day you open a .csv file from an accounting site in Excel. You then spend several minutes deleting unnecessary columns, formatting a table, adding formulas, and creating a PivotTable in a new worksheet. Those actions you repeat daily can be recorded once with the action recorder. From then on, running the script will take care of your entire .csv conversion. You'll not only remove the risk of forgetting steps, but be able to share your process with others without having to teach them anything. Office Scripts allows you to automate your common tasks so you and your workplace can be more efficient and productive. -## Action Recorder +## Action recorder -:::image type="content" source="../images/action-recorder-intro.png" alt-text="A list of actions recorded by Action Recorder."::: +:::image type="content" source="../images/action-recorder-intro.png" alt-text="A list of actions recorded by the action recorder."::: -The Action Recorder records actions you take in Excel and saves them as a script. With the Action recorder running, you can capture the Excel actions as you edit cells, change formatting, and create tables. The resulting script can be run on other worksheets and workbooks to recreate your original actions. +The action recorder tracks steps you take in Excel and saves them as a script. With the action recorder running, you can capture the Excel actions as you edit cells, change formatting, and create tables. The resulting script can be run on other worksheets and workbooks to recreate your original actions. -More information about the Action Recorder can be found in the article [Record your actions as Office Script](https://support.microsoft.com/office/453ab58d-708f-40a9-ab87-99a743bfa69a). +More information about the action recorder can be found in the article [Record your actions as Office Scripts](https://support.microsoft.com/office/453ab58d-708f-40a9-ab87-99a743bfa69a). -## Code Editor +## Code editor -:::image type="content" source="../images/code-editor-intro.png" alt-text="The Code Editor showing the script code used in this tutorial."::: +:::image type="content" source="../images/code-editor-intro.png" alt-text="The code editor showing the script code used in this tutorial."::: -Use the Code Editor to edit scripts recorded with the Action Recorder or make a brand new script. This tool lets you tweak and customize scripts to better suit your exact needs. You can also add logic and functionality that is not directly accessible through the Excel UI, such as conditional statements (if/else) and loops. +Use the code editor to edit scripts created with the action recorder, or make a brand new script. This tool lets you tweak and customize scripts to suit your exact needs. You can also add logic and functionality that is not directly accessible through the Excel UI, such as conditional statements (if/else) and loops. > [!TIP] -> The Action Recorder has a **Copy as code** button to record actions into script code without saving the entire script. +> The action recorder has a **Copy as code** button to record actions into script code without saving the entire script. > -> :::image type="content" source="../images/action-recorder-copy-code.png" alt-text="The Action Recorder task pane with the 'Copy as code' button highlighted."::: +> :::image type="content" source="../images/action-recorder-copy-code.png" alt-text="The action recorder task pane with the 'Copy as code' button highlighted."::: -Our [tutorials](../tutorials/excel-tutorial.md) provide a guided and structured way learn the capabilities of Office Scripts. After completing the tutorials, read [Fundamentals for Office Scripts in Excel](../develop/scripting-fundamentals.md) to learn more about the Code Editor and how to write and edit your own scripts. For additional information about the Code Editor and how your script code is interpreted, read [Office Scripts Code Editor environment](code-editor-environment.md). +Our [tutorials](../tutorials/excel-tutorial.md) provide a guided and structured way to learn the capabilities of Office Scripts. After completing the tutorials, read [Fundamentals for Office Scripts in Excel](../develop/scripting-fundamentals.md) to learn more about the code editor and how to write and edit your own scripts. For additional information about the code editor and how your script code is interpreted, read [Office Scripts code editor environment](code-editor-environment.md). ## Share Office Scripts -Office Scripts can be shared with other users in your organization. When you share a script in a shared workbook, team members with access to the workbook can also view and run your script. For more details about sharing and unsharing scripts, see [Sharing Office Scripts in Excel](https://support.microsoft.com/office/226eddbc-3a44-4540-acfe-fccda3d1122b). +Office Scripts can be shared with other users in your organization. When you associate a script with a workbook, team members with access to the workbook can also view and run your script. For more details about sharing scripts, see [Sharing Office Scripts in Excel](https://support.microsoft.com/office/226eddbc-3a44-4540-acfe-fccda3d1122b). Add buttons that run scripts to help your colleagues discover your valuable solutions and let them run scripts straight from the workbook. Learn more about script buttons in [Run Office Scripts with buttons](../develop/script-buttons.md). -:::image type="content" source="../images/add-button.png" alt-text="The 'Add in workbook' button on the 'Create Report' script details page with a button named 'Create Report' shown in the Excel grid."::: +:::image type="content" source="../images/share-this-script.png" alt-text="The 'Share this script' section of the script details page, with the 'Associate with workbook' toggle enabled."::: > [!NOTE] > Learn more about how scripts are stored in your OneDrive in [Office Scripts file storage and ownership](script-storage.md). @@ -61,9 +61,9 @@ Add buttons that run scripts to help your colleagues discover your valuable solu Set your scripts to run every day and keep your workbook up-to-date. Once you have your script, you can set it to automatically run on the workbook at regular intervals. A behind-the-scenes Power Automate flow ensures everything happens, even when the workbook is closed. -To schedule a script, open the script in the Code Editor. Open the **Script scheduling** section and complete the sign in process to Excel through Power Automate. Set how often you want the script to run and select **Create flow** to begin. +To schedule a script, open the script in the code editor. Open the **Script scheduling** section and complete the sign in process to Excel through Power Automate. Set how often you want the script to run and select **Create flow** to begin. -:::image type="content" source="../images/schedule-a-script.png" alt-text="The Code Editor task pane that shows the recurrence interval options for scheduling a script."::: +:::image type="content" source="../images/schedule-a-script.png" alt-text="The code editor task pane that shows the recurrence interval options for scheduling a script."::: ## Connect Office Scripts to Power Automate diff --git a/docs/testing/troubleshooting.md b/docs/testing/troubleshooting.md index 09f9ea86..a37afd8f 100644 --- a/docs/testing/troubleshooting.md +++ b/docs/testing/troubleshooting.md @@ -2,7 +2,7 @@ title: Troubleshoot Office Scripts description: Debugging tips and techniques for Office Scripts, as well as help resources. ms.topic: troubleshooting-general -ms.date: 01/23/2024 +ms.date: 02/26/2026 ms.localizationpriority: medium --- @@ -26,9 +26,9 @@ Office Scripts errors fall into one of two categories: ### Compile-time errors -Compile-time errors and warnings are initially shown in the Code Editor. These are shown by the wavy red underlines in the editor. They're also displayed under the **Problems** tab at the bottom of the Code Editor task pane. Selecting the error gives more details about the problem and suggests solutions. Compile-time errors should be addressed before running the script. +Compile-time errors and warnings are initially shown in the code editor. These are shown by the wavy red underlines in the editor. They're also displayed under the **Problems** tab at the bottom of the code editor task pane. Selecting the error gives more details about the problem and suggests solutions. Compile-time errors should be addressed before running the script. -:::image type="content" source="../images/explicit-any-editor-message.png" alt-text="A compiler error shown in the Code Editor's hover text."::: +:::image type="content" source="../images/explicit-any-editor-message.png" alt-text="A compiler error shown in the code editor's hover text."::: You may also see orange warning underlines and grey informational messages. These indicate performance suggestions or other possibilities where the script may have unintentional effects. Such warnings should be examined closely before dismissing them. @@ -51,11 +51,13 @@ Some runtime errors are caused by exceeding the limits of the platform, such as Both compile-time and runtime errors display error messages in the console when a script runs. They give a line number where the problem was encountered. Keep in mind that the root cause of any issue may be a different line of code than what is indicated in the console. -The following image shows the console output for the [explicit `any`](../develop/typescript-restrictions.md) compiler error. Note the text `[5, 16]` at the beginning of the error string. This indicates the error is on line 5, starting at character 16. -:::image type="content" source="../images/explicit-any-error-message.png" alt-text="The Code Editor console displaying an explicit `any` error message."::: +The following image shows the console output for the [explicit `any`](../develop/typescript-restrictions.md) compiler error. Note the text `[6, 14]` at the beginning of the error string. This indicates the error is on line 6, starting at character 14. -The follow image shows the console output for a runtime error. Here, the script tries to add a worksheet with a the name of an existing worksheet. Again, note the "Line 2" preceding the error to show which line to investigate. -:::image type="content" source="../images/runtime-error-console.png" alt-text="The Code Editor console displaying an error from the `addWorksheet` call."::: +:::image type="content" source="../images/explicit-any-error-message.png" alt-text="The code editor console displaying an explicit `any` error message."::: + +The following image shows the console output for a runtime error. Here, the script tries to add a worksheet with the name of an existing worksheet. Again, note the "Line 3" preceding the error to show which line to investigate. + +:::image type="content" source="../images/runtime-error-console.png" alt-text="The code editor console displaying an error from the `addWorksheet` call."::: ## Console logs @@ -66,7 +68,7 @@ console.log("Logging myRange's address."); console.log(myRange.getAddress()); ``` -Strings passed to `console.log` are displayed in the Code Editor's logging console, at the bottom of the task pane. Logs are found on the **Output** tab, though the tab automatically gains focus when a log is written. +Strings passed to `console.log` are displayed in the code editor's logging console, at the bottom of the task pane. Logs are found on the **Output** tab, though the tab automatically gains focus when a log is written. Logs do not affect the workbook. @@ -92,7 +94,7 @@ Scheduling a script requires a business license for Microsoft 365. This is neede The following list shows common errors you might encounter. -- **The access token expiry UTC time is earlier than current UTC time.**: Too much time has passed between signing into the service and scheduling the script. Reopen the script in the Code Editor or reload the workbook and try to schedule again. +- **The access token expiry UTC time is earlier than current UTC time.**: Too much time has passed between signing into the service and scheduling the script. Reopen the script in the code editor or reload the workbook and try to schedule again. ## Help resources diff --git a/docs/toc.yml b/docs/toc.yml index 372be45c..48ce2fbc 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -29,7 +29,7 @@ items: href: develop/best-practices.md - name: Built-in JavaScript objects href: develop/javascript-objects.md - - name: Code Editor environment + - name: Code editor environment href: overview/code-editor-environment.md - name: External API call support in Office Scripts href: develop/external-calls.md