首先安装 xlsx依赖
npm i / yarn add xlsx
比较简单,直接上代码
导出的数据格式:
const data = [
{
name: '姓名',
age: 18,
address: '浙江省杭州市xxxx',
high1: '高级信息1',
high2: '高级信息2',
high3: '高级信息3',
},
{
name: '姓名1',
age: 28,
address: '浙江省杭州市xxxx1111',
high1: '高级信息1111',
high2: '高级信息2222',
high3: '高级信息3333'