2

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.

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

6 Comments

Also, your best bet will be to be on the Insider build of Office, to make sure that you have the latest version of Office that will support the APIs.
Side-note, @Marc: As for the 1.7 APIs, they are out: see dev.office.com/blogs/excel-javascript-api-1-7-goes-ga for more info
using the beta link did the trick. I didn't need to get into insider program. I am on build 1804. Interesting thing: if (Office.context.requirements.isSetSupported('ExcelApi', 1.7) === true) gave true. 1.8 didn't. But the requested operation is there :)
@MichaelZlatkovsky-Microsoft You're right, I should have been a little clearer. I'll update my answer.
@tec-goblin, this is actually expected. Beta APIs are specifically shown as not being part of an officially supported set, since the APIs may change or be renamed/postponed/moved etc.
|
1

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

2 Comments

Thanks, do I need to enable some kind of preview functionality? Because for the moment I get "Object doesn't support property or method 'createWorkbook'" when doing that.
It worked. That said, would it be too much to ask for the possibility to decide on the name of the created files? ;) - I see it's not available, but consider it a feature request. My scenario is that I want to split an excel into multiple ones based on a discriminator column (let's say one per country).
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.