tec-goblin
tec-goblin

Reputation: 316

Can I create a workbook with Excel javascript add in?

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.

Upvotes: 2

Views: 2123

Answers (3)

Boketto
Boketto

Reputation: 885

Update 2020

There is a method you can simply use for creating a new Excel Workbook

Excel.createWorkbook()

Reference: https://learn.microsoft.com/en-us/office/dev/add-ins/excel/excel-add-ins-workbooks#create-a-workbook

Upvotes: 0

Marc LaFleur
Marc LaFleur

Reputation: 33094

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.

Upvotes: 2

MSFT-Jipyua
MSFT-Jipyua

Reputation: 391

The API for Excel is now under previewing, you can try to call through this way: context.application.createWorkbook(base64);

Upvotes: 1

Related Questions