const xlsx = require("node-xlsx"); const data = [ ["Jack", "男", 18, 180], ["Amy", "女", 19, 165], ["Ann", "女", 18, 162], ];
const buffer = xlsx.build([{ name: "mySheetName", data: data }]);
fs.writeFile("member.xlsx", buffer, "binary", (err) => { if (err) { console.log(err); } else { console.log("生成成功"); } });
|