1
votes

I am using the below function to get the range values from the Excel online. I am using the Script lab addin developed by Microsoft.

Excel.run(function (ctx) {
    var sheetName = "Sheet1";
    var rangeAddress = "K6:K500";
    var range = ctx.workbook.worksheets.getItem(sheetName).getRange(rangeAddress);
    range.load('values');

    return ctx.sync().then(function () {
        console.log(range);
    });
}).catch(function (error) {
    console.log("Error: " + error);
    if (error instanceof OfficeExtension.Error) {
        console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

The problem is that I get an Internal server error exception when I try to get the rows more than 500.

Please note that this behavior is not seen on normal Excel files that contains numbers and text. My sheet contains (especially in Column K which I am trying to fetch from the program) more than 250 characters in each cell. When I use this template, I get this internal server error. Also this issue is seen only in Excel Online and it works perfectly in Excel Desktop Client.

1

1 Answers

0
votes

That is a pretty large set of data. Making a single call for such a large range is a known issue.

From the documentation:

Read or write to a large range

If a range contains a large number of cells, values, number formats, and/or formulas, it may not be possible to run API operations on that range. The API will always make a best attempt to run the requested operation on a range (i.e., to retrieve or write the specified data), but attempting to perform read or write operations for a large range may result in an API error due to excessive resource utilization. To avoid such errors, we recommend that you run separate read or write operations for smaller subsets of a large range, instead of attempting to run a single read or write operation on a large range.