this article illustrates the way nodejs simply reads and writes excel content. Share to you for your reference, as follows:


node-xlsx: Node.js parsing excel file and excel file is generated based on the data, only supports xlsx format file;

, I will show the extracted data from Excel files uploaded by node-xlsx, and generate new Excel files.

 var code as follows: xlsx = require ('node-xlsx'); VAR FS = require ('fs'); / / read the contents of the file (__dirname+'/test.xlsx') = xlsx.parse var obj; VAR excelObj=obj[0].data; console.log (excelObj); VAR data = []; for (VaR I in excelObj) {var arr=[]; VAR value=excelObj[i]; for (VaR J in value (value[j]) {arr.push}); data.push (ARR) (buffer = VaR;} {data:data} [name:'sheet1']); / / fs.writeFileSync inserts the contents of the file into a new file ('test1.xlsx', buffer, {'flag','w'}); 

hope to help the nodejs programming.

you might be interested in this article: