So I am working on a code which exports Data Names, IDs etc. from a Server to the Browser from the User in a Excel Sheet.
Now as I am programming asychronous with NodeJS, it could be that sometimes the Server will send the response with the Excel Sheet, before all the data could be exported into it.
My workmates told me, that they use the .async Package for it. Here is the Link to it. I think we should be using this method.
Now this is my code:
appDataIDList.forEach((appDataID, index) => {
appData.getByID(appDataID.id).then((appData) => {
ws.cell(index + 1,1).string(appData.name).style(style);
callback();
})
});
wb.write('ExcelReport.xlsx', res);
My Problem is that I do not exactly know how to implement my code in to the method to make it work, because the async Package seems complex to me.