引入x-spreadsheet和SheetJS
<script src="/xspreadsheet/xspreadsheet.js"></script> <script src="/xspreadsheet/zh-cn.js"></script> <script src="/xspreadsheet/xlsxspread.js"></script> <script src="/sheetjs/xlsx.full.min.js"></script>
<script src="/xspreadsheet/xspreadsheet.js"></script>
<script src="/xspreadsheet/zh-cn.js"></script>
<script src="/xspreadsheet/xlsxspread.js"></script>
<script src="/sheetjs/xlsx.full.min.js"></script>
然后執行以下js導出
const xs = new Spreadsheet("#x-spreadsheet-demo") var outputfilename="導出數據.xlsx"; var new_wb = xtos(xs.getData()); XLSX.writeFile(new_wb, outputfilename, {});
const xs = new Spreadsheet("#x-spreadsheet-demo")
var outputfilename="導出數據.xlsx";
var new_wb = xtos(xs.getData());
XLSX.writeFile(new_wb, outputfilename, {});