爬虫数据可以写入txt文件,但不能写入excel中?
发布于 7 年前 作者 ycx0303 3225 次浏览 来自 问答

这样写是可以的: function printItemInfo(itemInfo) { var ws = fs.createWriteStream(‘stradewVallry.txt’,‘utf-8’); itemInfo.forEach(function (item) { var name = item.name; var source = item.source; var recipe = item.recipe; ws.write(’【’ + name + ‘】’ + ‘【’ + source + ‘】’ + ‘【’ + recipe + ‘】’ + ‘\r\n’); console.log(’【’ + name + ‘】’ + ‘【’ + source + ‘】’ + ‘【’ + recipe + ‘】’ + ‘\n’); }); ws.end(); } 但如果想导入excel中,直接改成: var ws = fs.createWriteStream(‘stradewVallry.xslx’,‘utf-8’); 好像就不行了。 想导入excel中应该怎么做??

回到顶部