1. 安装插件:npm install js-export-excel
2.使用:
const ExportJsonExcel = require('js-export-excel')
var option={};
option.fileName = 'excel'
option.datas= [ {
sheetData:[ {one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'} ],
sheetName:'sheet',
sheetFilter:['two','one'],
sheetHeader:['第一列','第二列']
},{
sheetData:[{one:'一行一列',two:'一行二列'},{one:'二行一列',two:'二行二列'}]
} ];
var toExcel = new ExportJsonExcel(option);
toExcel.saveExcel(); //保存
网友评论