从数据中导出数据并以本地excel格式存储。数据mong是数据格式。以数组格式排列数据。使用node-xlsx方法导出数据。constxlsx=require("node-xlsx")constfs=require("fs")constmong=require("./ThomDate.js")letjson=[{"name":"800条数据","data":[]}]mong.find({url:{}},(err,result)=>{result.map((i)=>{letlist=[]list.push(i.title)列表.push(i.des)list.push(i.url)json[0]["data"].push(list)})letfile=xlsx.build(json)fs.writeFileSync("./info2.xlsx)",文件)process.exit();})
