Downloading a file or creating a workbook with new data using Excel api
We have created a plugin for Excel that uses the Javascript Api (in typescript). We would like to allow the user to download a file that has some report data. The following code works in our plug in when we run excel in chrome, but not in the excel app on the mac.
const file = new File(["foo"], "new-note.txt", {
type: "text/plain",
});
const link = document.createElement("a");
const url = URL.createObjectURL(file);
link.href = url;
link.download = file.name;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
I know this is due to an issue with downloading a file in safari. Is there a way to do this using the Excel api?
Alternatively, we could create a new workbook with that data. But the examples for Excel.createWorkbook
all involve using data from an existing workbook. Is there a way to use Excel.createWorkbook
to create a workbook populated with new data, or to set values in the newly created workbook? Thanks!