Skip to content
Advertisement

Excel JavaScript API fails to read range from sheet Edge vs IE

We have an Excel add-in which writes a range to an Excel sheet and lets the user modify it. Once they are done they will press a button on which we will read the range from the sheet and will try to parse it.

Excel has recently updated its integration browser: https://learn.microsoft.com/en-us/office/dev/add-ins/concepts/browsers-used-by-office-web-add-ins

Windows 10 ver. < 1903 / Office 365
Internet Explorer 11

Windows 10 ver. >= 1903 / Office 365 ver < 16.0.11629
Internet Explorer 11

Windows 10 ver. >= 1903 / Office 365 ver >= 16.0.11629
Microsoft Edge*

We traced a problem with this edge based implementation. and made a code example for this.

When we load an excel sheet with a range from A1:A100 with random strings (80 characters each) we fail to load the range from the worksheet. The task pane in the i.e. version does hit the comment but in edge it does not get hit.

We try to load the range with the following code:

// Run a batch operation against the Excel object model
Excel.run(function (ctx) {
    // Create a proxy object for the used range and load its properties    
    var sourceRange = ctx.workbook.worksheets.getActiveWorksheet().getUsedRange().load("values, rowCount, columnCount");
    // Run the queued-up command, and return a promise to indicate task completion
    return ctx.sync()
                .then(function () {
                    // Unhit code in edge only ????              
                })
                .then(ctx.sync);
        })
        .catch(errorHandler);

Advertisement

Answer

It was a bug in office js. it has been fixed and is available as office insider build on 10-09-2019

https://github.com/OfficeDev/office-js/issues/697

Advertisement