Back to Examples

JSS to XLSX export Extension

XLSX render is a premium extension and not part of the default distribution.

<html>
<script src="https://jspreadsheet.com/v9/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v9/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />

<script src="https://cdn.jsdelivr.net/npm/jszip@3.6.0/dist/jszip.min.js"></script>
<script src="https://jspreadsheet.com/v9/plugins/parser.js"></script>
<script src="https://jspreadsheet.com/v9/plugins/render.js"></script>

<div id="spreadsheet"></div>

<br/>
<input type='button' value='Export to XLSX' id="downloadbtn">

<script>
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('YWU0OTlmOTc5ZjczMGU3MmQ5NjBmMzg5MWI0ZWI1YjM5NDE4YzBiODE1YTRiMDY5MGNiZDJkZGUzMDk0MmRhOWY5OTNiMDgzMGU2NDljNTY0ZDFiYTQ3YTZiNjZmMzFmMjZhM2U2N2FkOGNkYjg0MmFkMDViMjc4ZTEwZDY4NzAsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpJeE5qTXdNelEzTENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');

// Set the extensions
jspreadsheet.setExtensions({ parser, render });

// Import a XLSX file from a remote file
jspreadsheet.parser({
    url: '/jspreadsheet/list.xlsx',
    onload: function(config) {
        jspreadsheet(document.getElementById('spreadsheet'), config);
    },
});

// Download method
document.getElementById("downloadbtn").onclick = function() {
    // Render to XLSX
    jspreadsheet.render(document.getElementById('spreadsheet'), {
        filename: 'export.xlsx',
    });
}
</script>
</html>