import moment from "moment";
import XLSX from "xlsx";
const fileName = `导出_${moment().format('YYYYMMDDHHmmss')}`
const workbook = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(sheetData);
XLSX.utils.book_append_sheet(workbook, ws, "sheet1");
// 合并单元格
const merges = [
// 合并index第0行第0列 到 第1行第0列
{ s: { r: 0, c: 0 }, e: { r: 1, c: 0 } },
// 合并index第0行第1列 到 第0行第4列
{ s: { r: 0, c: 1 }, e: { r: 0, c: 4 } },
// 合并index第0行第5列 到 第0行第8列
{ s: { r: 0, c: 5 }, e: { r: 0, c: 8 } },
]
ws['!merges'] = merges
XLSX.writeFile(workbook, fileName + ".xlsx", { type: "binary" });