CNode

爬虫数据可以写入txt文件,但不能写入excel中?

问答
Yycx0303发布于9 年前最后回复9 年前2 回复3862 浏览0 收藏

这样写是可以的: 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中应该怎么做??

查看回复

回复 (2)

S
SHocker-Yu#2·9 年前
参与回复
登录后即可参与回复。登录