You can write JavaScript in Excel!

What if you could launch Excel and code in JavaScript to interact with your document?

Bhargav Krishna
Script Lab
3 min readMay 4, 2017

--

Quarterly sales report generated using Script Lab

Imagine generating an annual report, calculating a student grade sheet, automating your finances or simply exploring JavaScript or TypeScript with a simple install.

If that got your attention and you want to get started, then get Script Lab from here.

If you need some more context then here it is:

Script Lab is a tool for anyone who wants to learn code for Excel, Word, PowerPoint or Project. It suitable either for an experienced Office developer who wants to quickly prototype a feature; or the beginner who’s never tried writing code for Office and wants to learn more.

What makes Script Lab great is that you can use JavaScript or TypeScript to directly interact with your Excel, Word or PowerPoint documents and hence provides powerful intellisense support to make development easy. It also integrates with GitHub, allowing you to share your snippets as gists and import someone’s snippet for yourself.

Things to know

The design is similar to that of Visual Studio Code because conceptually, your project begins here as a prototype and eventually ends in Visual Studio, Visual Studio Code etc. as a product. It is powered by the Monaco Editor and uses the Office JavaScript APIs to interact with documents. It is developed using Angular and @ngrx.

Script Lab — Code editor

Your snippets can use HTML, CSS and JavaScript or TypeScript in separate tabs.

Using the Libraries tab, you can get any package from npm by keying in the package name or by using a http(s) link. You can also get the typings for adding intellisense similarly via @types.

What’s more? There’s a Run pane which can be launched independently. Every time you make a change, the Run pane updates instantly.

Did I mention you can share your snippets through GitHub? Use the Share menu to send the link to someone so they can try it and tweak it on their machine. Lastly, the Import menu lets you load other people’s snippets.

Before you go…

Script Lab ships with loads of samples for you to try out. You can get to them simply by opening the hamburger menu. These demonstrate what you can achieve today by integrating with Office.

Script Lab — Import screen

You can install Script Lab right now for free from the Office Store. Script Lab works in Excel, Word, PowerPoint and Project. However you will need Office 2013 and later, Office Online or Office for Mac.

If you are interested in contributing or have cool ideas, head over to the GitHub repository. But before you go, please like/share this post and help spread the word.

Until next time…

--

--

Bhargav Krishna
Script Lab

Web Developer @Microsoft. I love design, gaming, cars, movies and JavaScript.