Script Lab, a Microsoft Garage project
Experiment with the Office JavaScript API without ever leaving Excel, Outlook, Word, or PowerPoint! Get Script Lab in Excel, Word, and PowerPoint, or Script Lab for Outlook, free from Microsoft AppSource.
Note: Script Lab was rewritten from the ground up in 2018 on a brand-new technology stack, including React and Fabric React. Learn more about the older version of Script Lab 2017.
Topics
- Script Lab, a Microsoft Garage project
- Topics
- What is Script Lab?
- Get Started
- Import someone else's snippet, or export your own
- Report a bug, or suggest a feature
- Script Lab vs. "Script Lab 2017"
- Use Script Lab with older Office versions (Office 2013)
- Stay up-to-date
- Contribute to Script Lab
- Rate and review
- Articles & FAQs
- External blog posts & media coverage
- Build Status
What is Script Lab?
Wouldn't it be crazy if you could launch Excel, click to open a small code window, and then instantly start writing and executing JavaScript that interacts with your spreadsheet?
Script lab is a tool for anyone who wants to learn about writing Office Add-ins for Excel, Outlook, Word, or PowerPoint. The focus is the Office JavaScript API, which is the technology you need for building Office Add-ins that run across platforms. Maybe you're an experienced Office developer and you want to quickly prototype a feature for your add-in. Or maybe you've never tried writing code for Office and you just want to play with a sample and tweak it to learn more. Either way, Script Lab is for you.
Script Lab has three main features:
- Code in a pane beside your spreadsheet. IntelliSense is there while you type so you can easily discover and use the Office JavaScript objects and methods. And if you don't want to start from scratch there are plenty of samples pre-installed with Script Lab. Your snippets can use any TypeScript features like arrow functions, template strings, and async/await (i.e., a good chunk of ES6 and ES7 features). But it's not only script: your snippets can also use HTML, CSS, and references to external libraries and data on the web. Script Lab uses the Monaco editor, the same tech that powers VS Code, so it's beautiful and lightweight.
- Run the code in another pane beside the editor. Execution can include logic, API calls to Office, UI in the pane, and even output to a console. Every time you make a code change you can refresh the editor and run the new version in seconds.
- Share your snippets through GitHub. If you create a snippet you'd like to share, you can use Script Lab to save it. Then send the link to someone else to try it and tweak it on their computer. The Import feature lets you load other people's snippets.
Script Lab works in Office 2013 or later on Windows, Office on the web, or Office on Mac.
You can get Script Lab right now for free from Microsoft AppSource! It works for Excel, Word, and PowerPoint.
If you're interested in developing for Outlook, you can get Script Lab for Outlook, also free from AppSource.
Script Lab is a Microsoft Garage project that began at a hackathon. You can read the story of the original Script Lab creation on the Garage website.
Here's a 1-minute teaser video to give you a taste:
Get Started
The easiest way to try Script Lab is in Excel with the tutorial workbook that walks you through the tool in a few steps. You can get it here: script-lab-tutorial.xlsx
Alternatively, you can start from scratch and get Script Lab in Excel, Word, or PowerPoint.
This 10-minute demo explains how to use the main features:
Import someone else's snippet, or export your own
Script Lab is built around sharing. If someone gives you a URL to a GitHub GIST, simply open Script Lab, use the hamburger menu at the top left to see the menu, and choose "Import" category (either on the left or top, depending on the available screen space). Then, enter the URL of the GIST, and click the "Import" button at the bottom of the screen. In just these few clicks, you will be able to view and run someone else's snippet!
Conversely, to share your snippet with someone, choose the "Share" menu within a particular snippet. You can share as a public or private GitHub Gist, or you can copy the entire snippet metadata to the clipboard, and share it from there.
Report a bug, or suggest a feature
To report a bug, create a new issue. Please provide as much detail as you can: tell us the operating system, the Office build number, and your browser (if you're using Office on the web).
If you have a suggestion for a feature, please feel free to file it under "issues" as well, and we will tag it appropriately. The more detail, the better! We also gladly accept pull requests... (see more at CONTRIBUTING.md).
Finally, if you have a question, please ask it on https://stackoverflow.com instead. Tag your questions with office-js
and scriptlab
.
Script Lab vs. "Script Lab 2017"
Script Lab was rewritten from scratch in 2018. Though its visual design remains similar to the 2017 version, its technology stack was overhauled to use React and Fabric React. Among the improvements are keyboard accessibility, a much faster runner, and user-configurable settings.
If you encounter issues or need one of the few features that haven't been ported over yet, you can -- for the time being -- switch to the 2017 version of Script Lab. To do so:
- Open the editor pane and select or create a snippet.
- In the bottom right of the editor, click the cog icon to open the settings.
- In a dropdown that will now appear on the left side of the footer, choose "Script Lab 2017" (instead of your current environment).
The original repo of the 2017 version, now in a mostly-archival state, can be found at https://github.com/OfficeDev/script-lab-2017.
Use Script Lab with older Office versions (Office 2013)
Office 2013 has several limitations compared to more recent versions.
First, there are far fewer supported objects and methods in the JavaScript API for Office 2013. As a result, many snippets that work on later versions of Office will not run in Office 2013. In the Samples menu we have included certain samples specifically designed to use only capabilities that are available in Office 2013. Those samples are marked (2013) in the sample title.
Second, Office 2013 (and Office 2016 RTM, if you don't have a Microsoft 365 subscription) does not support ribbon buttons for Script Lab. As a result, there's a different way to access the Code and Run functions:
- To Code, select the INSERT tab and choose My Add-ins, then insert Script Lab.
- To Run a snippet, click the small Run triangle icon at the top of the Script Lab code pane.
Stay up-to-date
- Follow @OfficeDev on Twitter
- Follow Script Lab articles on medium.com
- Join our Office Developer program at developer.microsoft.com
Contribute to Script Lab
There are a bunch of ways you can contribute to Script Lab:
- File bugs & suggestions (see more in "Report a bug, or suggest a feature" above).
- Contribute new samples, or improve existing one. Please submit a pull request to the office-js-snippets repo; more info in the README of that repo.
- Spread the word! Whether through writing a blog post (examples), recording a video, tweeting about us, or sharing snippets with colleagues or the StackOverflow community -- we want more of the world to use Script Lab!
- Help improve the documentation. If you feel like this README or the CONTRIBUTING.md doc could use more details, please send a pull request!
Finally, if you want to contribute code (bug fixes, features, localization, etc.), please see CONTRIBUTING.md to get you up and running with a local copy of Script Lab -- and then send us a pull request.
Rate and review
Leave a star-rating and (optionally) a review blurb for Script Lab on the Office Store review page.
Of course, we'd prefer that if you have issues you report them on GitHub instead, but you're free to leave any review comments you wish.
Articles & FAQs
- Announcing Script Lab React (January 1, 2019): Official blog post
- Script Lab overview: "You can write JavaScript in Excel!"
- Project history & the technology behind it: Episode 127 on the Office 365 Developer Podcast
External media coverage
- August 29, 2017: "Start Developing in OfficeJS Today with Script Lab" by David Craig at theofficecontext.com
- July 30, 2017: [German] "Eigene Script Lab Scripte in Office Online testen". (Auto-translation: "Test your own Script Lab scripts in Office Online") by Mourad Louha
- June 14, 2017: [Portuguese] "Script Lab: Novo add-in da Microsoft". (Auto-translation: "Script Lab: New Microsoft add-in"), by Leonardo Xavier.
- May 1, 2017: [German] "Prototyping von Microsoft Office JavaScript Add-Ins mit Script Lab". (Auto-translation: "Prototyping Microsoft Office JavaScript add-ins with Script Lab"), by Mourad Louha
- May 1, 2017: [Portuguese] "Microsoft lança o Script Lab". (Auto-translation: "Microsoft Launches Script Lab"), by Felipe Costa Gualberto.
- April 18, 2017: "Microsoft Garage Releases Script Lab" by Ryan Maskell at winbuzzer.com
Build Status
Branch | Status | Runner | Server | Storybook |
---|---|---|---|---|
master | script-lab-react-alpha | script-lab-react-runner-alpha | script-lab-react-server-alpha | |
beta | script-lab-react-beta | script-lab-react-runner-beta | script-lab-react-server-beta | |
production | script-lab-react | script-lab-react-runner | script-lab-react-server |
This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.