Custom Functions in Excel: Developer Preview

I'm thrilled to announce that you can try writing custom functions in JavaScript starting today.

Custom functions (similar to "user-defined functions", or "UDFs") are JavaScript functions that you can build as part of your add-in. Users can see and run those functions in Excel alongside built-in functions like =SUM or =VLOOKUP. The best part is that those same functions will work everywhere add-ins do: on your PC, Mac, and iPad, and even in Excel Online. But for now the Developer Preview is only available on Windows.

Here's what it looks like in action:

Custom Function GIF

And here's the code I wrote for this simple function:

function add42(num1, num2) {
return num1 + num2 + 42;
}

We've had tons of requests from developers who want to use custom functions for all kinds of reasons. Here are a few ideas:

  • Calculate math operations, like whether a number is prime
  • Fetch info from the web, like a bank account balance
  • Stream live data, like a stock price

Get all the details and try custom functions for yourself at aka.ms/customfunctions.

We're hard at work on lots of improvements for the current preview so that custom functions will be even more powerful when we ship officially. So we hope you'll give us as much feedback as possible: post suggestions to the Excel Add-ins UserVoice page and tag Stack Overflow questions with the custom-functions-excel tag.

Happy coding!