Background: low-code platform (no backend)
Requirement:: Download the tablel list into an excel file
accomplish:
Install: xlsx
yarn add xlsx -d
Quote:
import * as XLSX from 'xlsx';
function downloadExcelFile(tableData, fileName) {
const worksheet = XLSX.utils.table_to_sheet(tableData);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
XLSX.writeFile(workbook, fileName);
}
// Example usage:
const table = document.getElementById('myTable');
downloadExcelFile(table, 'myTable.xlsx');
The downloaded file opens as follows