title | description | ms.date | ms.topic | ms.custom | localization_priority |
---|---|---|---|---|---|
Explore Office JavaScript API using Script Lab |
Use Script Lab to explore the Office JS API and to prototype functionality. |
06/18/2021 |
conceptual |
scenarios:getting-started |
Priority |
The Script Lab and Script Lab for Outlook add-ins, available free from AppSource, enable you to explore the Office JavaScript API while you're working in an Office program such as Excel or Outlook. Script Lab is a convenient tool to add to your development toolkit as you prototype and verify functionality you want in your own add-in.
Script Lab is a tool for anyone who wants to learn how to develop Office Add-ins using the Office JavaScript API in Excel, Outlook, Word, and PowerPoint. It provides IntelliSense so you can see what's available and is built on the Monaco framework, the same framework used by Visual Studio Code. Through Script Lab, you can access a library of samples to quickly try out features or you can use a sample as the starting point for your own code. You can even use Script Lab to try preview APIs.
Sounds good so far? Take a look at this one-minute video to see Script Lab in action.
Script Lab offers a number of features to help you explore the Office JavaScript API and prototype add-in functionality.
Get started quickly with a collection of built-in sample snippets that show how to complete tasks with the API. You can run the samples to instantly see the result in the task pane or document, examine the samples to learn how the API works, and even use samples to prototype your own add-in.
In addition to JavaScript or TypeScript code that calls the Office JS API, each snippet also contains HTML markup that defines content of the task pane and CSS that defines the appearance of the task pane. You can customize the HTML markup and CSS to experiment with element placement and styling as you prototype task pane design for your own add-in.
Tip
To call preview APIs within a snippet, you'll need to update the snippet's libraries to use the beta CDN (https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
) and the preview type definitions @types/office-js-preview
. Additionally, some preview APIs are only accessible if you've signed up for the Office Insider program and are running an Insider build of Office.
By default, snippets that you open in Script Lab will be saved to your browser cache. To save a snippet permanently, you can export it to a GitHub gist. Create a secret gist to save a snippet exclusively for your own use, or create a public gist if you plan to share it with others.
You can import a snippet into Script Lab either by specifying the URL to the public GitHub gist where the snippet YAML is stored or by pasting in the complete YAML for the snippet. This feature may be useful in scenarios where someone else has shared their snippet with you by either publishing it to a GitHub gist or providing their snippet's YAML.
Script Lab is supported for Excel, Word, and PowerPoint on the following clients.
- Microsoft 365 Office subscription
- Office 2016 or later on Mac
- Office on the web
Script Lab for Outlook is available on the following clients.
- Microsoft 365 Office subscription
- Outlook 2016 or later on Mac
- Outlook on the web when using Chrome, Microsoft Edge, or Safari browsers
For more details on Script Lab for Outlook, see the related blog post.
Important
Sometime in 2021, Script Lab will stop working on the combinations of platform and Office version that use Internet Explorer to host add-ins. This includes one-time purchase Office versions through Office 2019, and some older versions of Microsoft 365 (subscription) Office. (For more information, see Browsers used by Office Add-ins.) You'll need other platform and version combinations to explore and test the Office JavaScript Library APIs with Script Lab. But the behavior of these APIs isn't different in Internet Explorer, so this isn't really a weakness of Script Lab. Note that Office Add-ins submitted to AppSource must support the platform and version combinations that use Internet Explorer to host add-ins.
To use Script Lab in Excel, Word, or PowerPoint, install the Script Lab add-in from AppSource.
To use Script Lab for Outlook, install the Script Lab for Outlook add-in from AppSource.
You're welcome to expand the sample library in Script Lab by contributing new snippets to the office-js-snippets GitHub repository.
When you're ready to create your first Office Add-in, try out the quick start for Excel, Outlook, Word, OneNote, PowerPoint, or Project.