What is Script Lab?
Sounds good so far? Take a look at this one-minute video to see Script Lab in action.
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.
Code and style
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.
Save and share snippets
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.
- Office 2013 or later on Windows
- Office 2016 or later on Mac
- Office on the web
To use Script Lab in Excel, Word, or PowerPoint, install the Script Lab 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.