Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mathewstudent

    (@mathewstudent)

    Thanks, I see what is the limitation and what can be done.

    Just in case anyone would need I am leaving some simple JS code to export full Data Table from front-end:

    <button onclick="exportToExcel('your_html_element_id', 'desired_export_file_name_and_sheet_name')">Export to Excel</button>
    
    
    <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
    
    function exportToExcel(tableElementId,fileName) {
            // Get table element
            var table = document.getElementById(tableElementId);
    
            // Create a new workbook
            var wb = XLSX.utils.book_new();
    
            // Convert table to worksheet
            var ws = XLSX.utils.table_to_sheet(table);
    
            //Add all records skipping one header
            XLSX.utils.sheet_add_aoa(ws, XLSX.utils.sheet_to_json(ws, { header: 1 }).slice(1));
    
    
            // Add the worksheet to the workbook
            XLSX.utils.book_append_sheet(wb, ws, fileName);
    
            // Generate the Excel file and download it
            XLSX.writeFile(wb, fileName + ".xlsx");
        }
    Thread Starter mathewstudent

    (@mathewstudent)

    Thank you for your help. It works as described.

Viewing 2 replies - 1 through 2 (of 2 total)