Create Office Add-in projects using Office Add-ins Development Kit for Visual Studio Code
Article
The Office Add-ins Development Kit helps set up your environment, create Office Add-ins, and debug your code in a streamlined experience.
Important
The Office Add-ins Development Kit extension only supports creating add-ins that use the add-in only manifest. It also only creates Excel, PowerPoint, and Word add-ins at this time. Support for Outlook is under development, as are additional samples and other improvements. We welcome any feedback you have on the tool. Issues and features requests should be submitted through GitHub issues on the extension's repo.
Node.js (the latest LTS version). Visit the Node.js site to download and install the right version for your operating system. To verify if you've already installed these tools, run the commands node -v and npm -v in your terminal.
Select View > Extensions or Ctrl+Shift+X. You can also open extensions by selecting the Extensions tab from the Visual Studio Code activity bar.
Enter Office Add-ins Development Kit in the search box.
Select Office Add-ins Development Kit. From the Office Add-ins Development Kit extension page that appears in the main pane, select Install. After successfully installing, the Office Add-ins Development Kit icon will appear in the Visual Studio Code activity bar.
Select Install on the web page. If you're prompted that the extension requires Visual Studio Code, select Continue.
Your browser may ask you to verify that the site is trying to open Visual Studio Code. Allow Visual Studio Code to open. Visual Studio Code will then open with the Office Add-ins Development Kit extension readme displayed.
Select Install in Visual Studio Code. After successfully installing, the Office Add-ins Development Kit icon will appear in the Visual Studio Code activity bar.
Create an add-in project
The Office Add-ins Development Kit offers two ways to get started with a new project: templates and samples. Templates let you choose the Office application, programming language, and starting feature. Samples are more complete projects that demonstrate a realistic scenario.
Create an add-in from a template
Templates offer a basic starting point for your add-in. They add a minimal amount of functionality so you can get started without changing much of the existing code. The following instructions describe how to make a new project from a template using the development kit.
Open Visual Studio Code and select the Office Add-ins Development Kit icon in the Activity Bar.
Select Create a New Add-in in the extension task pane.
In the now-active Quick Pick menu, select the Office application for your add-in.
Select an add-in template from the list of available templates.
Select "JavaScript" or "TypeScript" as the programming language.
In the Workspace folder dialog that opens, select the folder where you want to create the project.
Give a name to the project (with no spaces) when prompted. Office Add-ins Development Kit will create the project with basic files and scaffolding. It then opens the project in a second Visual Studio Code window. You can freely close the original Visual Studio Code window.
Create an add-in from a sample
Samples show a working add-in that solves an end-to-end scenario. Samples are most useful as learning tools to understand how features of the Office Add-ins framework work together. You can also expand a sample to fit your particular needs.
Open Visual Studio Code and select the Office Add-ins Development Kit icon in the Activity Bar.
Select View Samples.
Select the sample you would like to view.
Select the Create button above the now-open sample readme.
In the Workspace folder dialog that opens, select the folder where you want to create the project. The extension copies a version of the sample to that folder. It then opens the project in a second Visual Studio Code window. You can freely close the original Visual Studio Code window.
Test your add-in
To understand how the add-in will work in an Office application, use the Office Add-ins Development Kit to run and debug your Office add-in in your local development environment.
Note
These steps are the same as the ones listed in Visual Studio Code by the extension when you create a new project.
Open the extension by selecting the Office Add-ins Development Kit icon in the Activity Bar.
Select Preview Your Office Add-in (F5)
In the Quick Pick menu, select the option {Office Application} Desktop (Edge Chromium), where '{Office Application}' is the appropriate application, such as "Excel" or "Word". This will launch the add-in and debug the code.
The development kit checks that the prerequisites are met before debugging starts. Check the terminal for detailed information if there are issues with your environment. After this process, the Office desktop application launches and sideloads the add-in. Please note that the first time you run a project, it may make take a few minutes to install the dependencies. You'll need to install the certificate when prompted.
Stop testing your Office Add-in
Once you are finished testing and debugging the add-in, always close the add-in by following these steps. (Closing the Office application or web server window doesn't reliably deregister the add-in.)
Open the extension by selecting the Office Add-ins Development Kit icon in the Activity Bar.
Select Stop Previewing Your Office Add-in. This closes the web server and removes the add-in from the registry and cache.
Close the Office application window.
Troubleshooting
If you have problems running the add-in, take these steps.
Close any open instances of Office.
Close the previous web server started for the add-in with the Stop Previewing Your Office Add-in Office Add-ins Development Kit extension option.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins feedback
Office Add-ins is an open source project. Select a link to provide feedback: