4 ms·
A bit surprised that there's no TypeScript support, especially considering how verbose metadata you have to write as a result[1]. That whole thing could be made
by Daiz 8y ago
A bit surprised that there's no TypeScript support, especially considering how verbose metadata you have to write as a result[1]. That whole thing could be made much simpler with some TS and JSDoc, eg.
/**
* adds 42 to the input number
* @param a the first number to be added
* @param b the second number to be added
*/
function ADD42(a: number, b: number): number {
return a + b + 42;
}
[1] https://docs.microsoft.com/en-us/office/dev/add-ins/excel/custom-functions-overview https://docs.microsoft.com/en-us/office/dev/add-ins/excel/cu...
- chatmasta 8y agoAny reason you can’t just use TS and compile to JS?
- chaostheory 8y agoThat's not realistic unless you don't plan on maintaining the code. Even if you do have a process to constantly move compiled Javascript into Excel, let's say you lose a minute each time (which is really generous as the code grows). Assuming you make 60 changes a month, you could lose 12 hours of time per year just because TS support isn't built into Excel.
- fiatjaf 8y agoI think there's also a case for supporting every other language that compiles to JavaScript, since users of these languages will also lose 12 hours per year. Actually, every other language in the world besides JavaScript should be supported.
- sheetjs 8y agoIf you look at their example, the "type information" is actually encoded in an ancillary JSON file: https://github.com/OfficeDev/Excel-Custom-Functions/blob/master/customfunctions.json https://github.com/OfficeDev/Excel-Custom-Functions/blob/mas... In theory, you could embed all of the metadata in JSDoc + TS annotations.
- Analemma_ 8y agoPresumably there will be type definition files available at some point. That way the solution can be maximally general: JS for people who can't use TS for whatever reason (maybe because they're a legacy Excel shop that can't introduce new technologies), TypeScript for everyone else.
- paradite 8y agoBecause... this is no support for TypeScript in native JS runtimes? It would add to complexity if you introduce a compilation step before executing them in JS runtime, especially when you are targeting multiple platforms.
- Daiz 8y agoThat's hardly a problem. Since they can run JS, they could just add the TypeScript compiler itself into Excel and compile code on demand (and cache the results).
- msaunders77 8y agoHi, I'm the PM for the feature. Thanks for this feedback about TypeScript support! I totally agree that TypeScript is ideal for this use case. As other commenters have mentioned, we want to stay flexible for everyone, whether or not they use TypeScript. We'll provide support to make the TypeScript development experience great, like type definition files. You can compile any TS files to JS at development/deployment time (admittedly a little more legwork for your dev environment, yes). Finally, we'll be releasing an update for Script Lab[1] to support custom JavaScript functions soon. And since Script Lab supports TS we've used exactly the model you suggest above to define the function metadata in Script Lab. -Michael [1] https://github.com/OfficeDev/script-lab/blob/master/README.md https://github.com/OfficeDev/script-lab/blob/master/README.m...
- jimnotgym 8y agoI'm the kind of person this is directly aimed at, finance background, Excel officionado begging for a better scripting language. I can tell you that I am not interested in js for Excel one bit. Python for Excel however...
- NamTaf 8y agoI can't agree enough. Python baked in would be a dream come true.
- snthpy 8y ago+1
- msaunders77 8y agoWe did announce (but not yet release) custom Azure Machine Learning functions in Excel. I mention in the blog that since Python runs on Azure ML, you'll be able to run custom Python functions in the cloud, as part of Excel formulas[1]. That announced Azure ML feature is optimized for machine learning models (in terms of the tools/deployment/runtime we've provided), so even though it will work for any Python functions it might not be exactly what you're asking for. Also, depending on your specific use case, you may or may not need client-side execution (Azure ML functions run in the cloud today). I can't share specifics on other unannounced features, but Azure ML functions are only our first foray in this space: we think custom functions running in the cloud are very important for many different use cases in Excel. Also, note that on the JavaScript side, the language choice isn't something new for Excel or Office: for example, there's a public ecosystem of add-ins that automate Excel via JavaScript today[2]. Custom functions are just the latest way we've enabled for extending Excel as part of an add-in[3]. [1] https://dev.office.com/blogs/azure-machine-learning-javascript-custom-functions-and-power-bi-custom-visuals-further-expand-developers-capabilities-with-excel https://dev.office.com/blogs/azure-machine-learning-javascri... [2] https://appsource.microsoft.com/en-us/marketplace/apps?product=office%3Bexcel&page=1 https://appsource.microsoft.com/en-us/marketplace/apps?produ... [3] https://docs.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-overview https://docs.microsoft.com/en-us/office/dev/add-ins/excel/ex...