WebPartPage I reference the Script using a
ExcelWebPart. So another pre-requirement is a configured
ExcelWebPart on your
Part 1: Defining an UDF
Part 2: Registering the UDF
<code data-gist-id=id=”7420161” data-gist-file=”UDF_Registration.js”></code>
Within Part 2 it’s important that your script is running after ExcelWebPart has finished loading the Excel JSOM. See the following script which contains the entire JS logic.
###The entire sample code
If you’ve also loaded jQuery on your WebSite, you can of course use jQuery, to delay script execution until the current document is loaded as shown here.
Once you’ve referenced the JS file by using the ContentEditor WebPart and refreshed the site, you can easily access the UDF by editing a cell and typing in a ‘=’ sign followed by the name of your UDF.
In order to make this easier to use, I’ve added JS UDF Support to ShareCoffee’s backlog. So check out ShareCoffee recently to see ExcelServices JS UDF’s appearing there.