Microsoft Announces JavaScript Support for Excel Custom Functions

| by Dylan Schiemann Follow 7 Followers on Jun 07, 2018. Estimated reading time: 1 minute |

Microsoft recently announced a developer preview release supporting JavaScript to create custom functions directly in Excel. This addition moves beyond the existing Microsoft Office JavaScript API, which is limited to building add-ins or web applications that interact with the object models in Office host applications.

The Microsoft Office team has created a GitHub source code repository to learn how to use JavaScript within Excel functions. The example repository separates functionality into four primary areas:

  • JavaScript: custom function source code
  • JSON: metadata used by Excel to show available custom functions
  • HTML: preview release mechanism for referencing the relevant JavaScript source code and a method to initialize a custom function
  • XML: informs Excel about the location and namespace of the custom function and its resources

Custom functions have no associated user interface and developers should not attempt to manipulate the DOM. The project expects to remove the HTML file for custom function initialization before the final release of this feature.

Modern JavaScript features such as Promises are supported, allowing developers to define custom functions as synchronous, for quickly computed values, or asynchronous, for calculations that may take a while to complete. Streams, an asynchronous promise that returns a value multiple times rather than just once, are also an option for Excel custom JavaScript functions.

Excel's JavaScript leverages the same Chakra JavaScript engine used by the Microsoft Edge web browser. This addition brings some parity to Google Sheets which already supports JavaScript within Sheets' custom functions.

Custom functions support is currently limited to the developer preview versions of Excel for Windows, Mac, and Excel Online. Custom functions are not currently available for Excel on mobile devices, or in production versions of Excel.

TypeScript users may also write custom JavaScript functions. Like any other JavaScript environment, TypeScript should be transpiled to JavaScript. Microsoft does not intend to provide direct TypeScript support within Excel.

While there isn't an official production release date for custom JavaScript functions within Excel, those interested in custom JavaScript functions in Excel should try this preview release and provide feedback to the Office team.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you