I am trying to download JSON data to an excel. It works fine except when I am running a for loop and trying to download the array in chunks of 25, it always duplicates the last file. More specifically, if there is only one record in the array, still 2 files get created.
Below is my code:
var i, j, temparray, chunk = 25, fileNumber; var fileName = "Order export-"; for (i = 0, j = oModel.length, fileNumber = 1; i < j; i += chunk, fileNumber++) { temparray = oModel.slice(i, i + chunk); oSettings = { workbook: { columns: aCols }, dataSource: temparray, fileName: fileName.concat(fileNumber) }; var oSpreadsheet = new sap.ui.export.Spreadsheet(oSettings); oSpreadsheet.build().then(function () { sap.m.MessageToast.show("Spreadsheet export has finished"); });