0

I have some data and I am storing it in excel csv, using npm package excel4node. But as I run the script a new instance of workbook is created. If I am running the script multiple times I want to keep on appending the new data in the sheet rather than creating a new instance of the workbook.

var workbook = new excel.Workbook();
var worksheet = workbook.addWorksheet("sheet1");

for (var i = 1; i < allTexts.length + 1; i++) {

  worksheet.cell(i + 1, 1).string(allTexts[count]);
  worksheet.cell(i + 1, 3).string(allnumbers[count]);
  count++;
}

workbook.write("sample.csv");
codtex
  • 6,128
  • 2
  • 17
  • 34

1 Answers1

0

It doesn't look like there are any append methods in the docs. A workaround might be to use a different package to convert it to JSON first and then just add the data and export it as a new csv. I prefer to use csvtojson

Michael Ossig
  • 205
  • 2
  • 9