我有一个JSON对象数组,就像这样:
当我使用下面的代码时,它不起作用:
我正在使用SheetJS 0.9.11版本,想知道是否有任何方法将其导出为Excel格式?我已经卡在这里2天了。非常感谢您的帮助。
[
{"name":"John", "city": "Seattle"},
{"name":"Mike", "city": "Los Angeles"},
{"name":"Zach", "city": "New York"}
]
当我使用下面的代码时,它不起作用:
_export: function(records,opts) {
var XLSX = xlsx;
var fileName = opts.split(".")[2]
var workSheet = XLSX.utils.json_to_sheet(records);
console.log("THis is Worksheet",workSheet);
var wb = XLSX.utils.book_new();
console.log("THis is workbook",wb)
XLSX.utils.book_append_sheet(wb, workSheet, fileName);
var bin = XLSX.write(wb, {bookType:'xlsx',type: "binary"});
return new Blob([this._binStr2ArrBuff(bin)], { type: "" });
},
},
我正在使用SheetJS 0.9.11版本,想知道是否有任何方法将其导出为Excel格式?我已经卡在这里2天了。非常感谢您的帮助。