问题
Is there any equivalent for Excel javascript add-ins to do what we can do in Word with context.application.createDocument() ? I don't see any create method in Excel Application object.
回答1:
The API for Excel is now under previewing, you can try to call through this way: context.application.createWorkbook(base64);
回答2:
As @MSFT-Jipyua mentioned, createWorkbook()
is currently in "Preview" as part of v1.8. As it is in preview Preview (1.7 was just released in May and is rolling out to clients now) so keep in mind that this API won't work with all builds and platforms supported by Excel.
In order to call this API, you need to use the beta library release. This is hosted at https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
. You'll need to switch any references to the production library (https://appsforoffice.microsoft.com/lib/1/hosted/office.js
) to the beta library in order to access preview functionality.
来源:https://stackoverflow.com/questions/50550472/can-i-create-a-workbook-with-excel-javascript-add-in