Referencing the JavaScript API for Office library from its content delivery network (CDN)


In addition to the steps described in this article, if you want to use TypeScript, then to get IntelliSense you will need run the following command in a Node-enabled system prompt (or git bash window) from the root of your project folder. You must have Node.js installed (which includes npm).

npm install --save-dev @types/office-js

The JavaScript API for Office library consists of the Office.js file and associated host application-specific .js files, such as Excel-15.js and Outlook-15.js.

The simplest way to reference the API is to use our CDN by adding the following <script> to your page's <head> tag:

<script src="" type="text/javascript"></script>

The /1/ in front of office.js in the CDN URL specifies the latest incremental release within version 1 of Office.js. Because the JavaScript API for Office maintains backward compatibility, the latest release will continue to support API members that were introduced earlier in version 1. If you need to upgrade an existing project, see Update the version of your JavaScript API for Office and manifest schema files.

If you plan to publish your Office Add-in from AppSource, you must use this CDN reference. Local references are only appropriate for internal, development, and debugging scenarios.


When you develop an add-in for any Office host application, reference the JavaScript API for Office from inside the <head> section of the page. This ensures that the API is fully initialized prior to any body elements. Office hosts require that add-ins initialize within 5 seconds of activation. If your add-in doesn't activate within this threshold, it will be declared unresponsive and an error message will be displayed to the user.

See also