Ability to open/replace workbook with Excel JS API in a similar way Word API can with insertFileFromBase64
We have a requirement to load a workbook from a remote source from within the add-in. User logs in, selects from a list and workbook template loads.
With the Word JS API we can load a template remotely using an AJAX call that returns the workbook as a base64 string and then insert the response into the current workbook using the replace option. AFAIK this doesn't exist for the Excel API and we download the workbook and then instruct the user to open from the download pane.
Hello! the API is in preview now! Make sure to have the latest insiders fast and use our Beta CDN, more info on this here https://aka.ms/excelapiopenspec
Here is a sample code snippet using the API
key line of code context.workbook.worksheets.addFromBase64(mybase64)
send an xlsx (base64 encoded)
please use it and send us feedback!
+1 to those below, sorely needed!
David Greenwood commented
When could this go GA?
Hi! I have a query regarding this API, the method will insert the sheets to your current opened sheets in Office but what if we want to delete the existing sheets and add the newly opened one. is there a way to do that?
/Hi! We tried using addFromBase64(myBase64) in Office 365 insider build and it is working. We want to know when will this API be available in production release of Office JS?
Hi! We also tried using context.workbook.worksheets.addFromBase64(mybase64) and it gives This operation is not implemented error. We have Beta CDN for Office JS and excel-web-16.00.js. Are we missing something here?
Aaron Nwabuoku commented
Hi! Is there a timeline of when this is expected to be stable and released? We tried using the API, following https://gist.github.com/jipyua/caec8eb5fddc0f611c43a1dbb356fa2a but received a "Not Implemented" error. We would like to send OOXML fragments from our remote servers to our Office Online Add-in going forward and this endpoint would be instrumental for that approach. Thanks!
Bowei Han commented
We are trying to do something similar but the API - context.workbook.worksheets.addFromBase64(mybase64) - is throwing a "Not Implemented" exception for us even though we have the Beta CDN in office online. In the documentation it says that replace workbook is a beta feature - https://github.com/OfficeDev/office-js-docs - but the API is not included in the exhaustive list - https://github.com/OfficeDev/office-js-docs/blob/ExcelJs_OpenSpec/betaMembers.md. Is there something that we are missing?
Dalibor Grudenić commented
Still very much needed even 2 years after original post.
Still very much needed.
Abhinav Tripathi commented
Looking forward to any updates on this thread.
This is an important feature for our development across Word, Excel and PowerPoint and we need for it to be aligned as soon as possible please. It would be very helpful if it came with future Office apps that support Add-In as well. Thank you.
Cory Isaacson commented
This will be a very important feature. It is also important to be able to load a sheet into a workbook using Open XML so that the application can provide this on the fly.
Adin Schmahmann commented
Additionally, aside from inserting the workbook from a base64 string it would be quite useful to insert the workbook from OOXML and generally Get/Set Excel (and PowerPoint) content from OOXML
We would like something like insertSheetFromBase64; which would also require method to getSheetBase64. Would include all sheet content, including images, rangeNames, formatting, charts, etc.