Closed priya0412 closed 5 years ago
const ws = XLSX.utils.aoa_to_sheet(rows); const ws1 = XLSX.utils.aoa_to_sheet(rows1); / write workbook (use type 'binary') / const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws,"sheet1"); XLSX.utils.book_appendsheet(wb, ws1,"sheet2"); const stream = XLSX.writeFile(wb, ..\out\processed\data${site}.csv, { flag: 'w+' });
You're writing to CSV, a single-sheet format. https://github.com/SheetJS/js-xlsx#supported-output-formats has a table of the supported output formats. multiple sheets are written for formats which are marked as "multi" in the sheets column, namely xlsx, xlsx, xlsx, biff8, biff5, xlml, ods, fods
Thankyou for your Reply Reviewher. Now I have xlsx with multiple sheets, how to write it to one .CSV .
const ws = XLSX.utils.aoa_to_sheet(rows); const ws1 = XLSX.utils.aoa_to_sheet(rows1); / write workbook (use type 'binary') / const wb = XLSX.utils.book_new(); //XLSX.utils.book_append_sheet(wb, ws,"sheet1"); XLSX.utils.book_appendsheet(wb, ws1,"sheet2"); const stream = XLSX.writeFile(wb, `..\out\processed\data${site}.csv`, { flag: 'w+' });