Reputation: 271
Would it be possible to have custom functions and a taskpane using the same html page? We would like to call and set custom functions on the worksheet based on certain actions/parameters coming from the taskpane.
Upvotes: 2
Views: 832
Reputation: 804
stay tuned, we're still working on the javascript runtime for custom functions. This will differ from the taskpanes which are running in a seperate IE process (on windows, at least).
In addition to the APIs called out here: https://learn.microsoft.com/en-us/office/dev/add-ins/excel/custom-functions-overview#known-issues, we're planning to have an API that allows you to share state with custom functions.
If you sign up at https://aka.ms/customfunctionscall, we can make sure we send you the info when it is available in a few weeks time. Will update this thread with details then.
In terms of setting custom functions you will be able to do that by entering a formula =CONTOSO.ADD42ASYNC(1,2), i.e:
async function setFormula() {
try {
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sheet1");
const range = sheet.getRange("A1");
range.formulas = [[ "=CONTOSO.ADD42(1,2)" ]];
await context.sync();
});
}
catch (error) {
console.log(error);
}
}
Upvotes: 1