I am trying to use the Excel API in my custom function in a manner similar to what is described here.
It works perfectly well on the Mac version of Excel and the Web version however, it doesn't work on the Windows version.
On Windows, I see reference error Excel is not defined
in the debugging log when the custom function tries to access the context with var context = new Excel.RequestContext();
.
How can I get this to work on Windows?
In order to call Excel API from a custom function on Windows, you need to config your add-in to use shared runtime. You can refer to the tutorial.