Products

Examples

Back to Examples

Export to XLS

You can now export from Jspreadsheet to a XLS file using a export plugin, as below.

Note: A security message should appear due the form the file is generated

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

<script src="/v7/plugins/download.js"></script>

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

<br/>
<input type='button' value='Export to XLS' id="exportbtn" />

<script>
let data1 = [
    ['Cheese', 10, 6.00, "=B1*C1"],
    ['Apples', 5, 4.00, "=B2*C2"],
    ['Carrots', 5, 1.00, "=B3*C3"],
    ['Oranges', 6, 2.00, "=B4*C4"],
];

let data2 = [
    ['20%', "=SHEET1!D1"],
    ['20%', "=SHEET1!D2"],
    ['20%', "=SHEET1!D3"],
    ['20%', "=SHEET1!D4"],
];

let jss = jspreadsheet(document.getElementById('spreadsheet'), [
    {
        data: data1,
        defaultColWidth: '100px',
        minDimensions: [5,5],
        license: 'OTZhNDYwZjk0MDUwNDNmMmU1MGFlYzBlMTgxNDc5MTNiYzAyN2E1YzJmNzEzMjdkOGU0MGU3YjY2NzQ4ODc2YmYzNjc3NTVlYTAyZmQ4ZjAzNmIwNGVkMWRhZWI0ZWE4NjFmN2NiYWE1OWViODQxZDY5Yjk3NTNiZWRjNmExNWYsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpNeU16TXhOamN5TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0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cGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ=='
    }
]);

document.getElementById("exportbtn").onclick = () => jspreadsheet.download(jss[0].el);
</script>
</html>

Export to XLS plugin

This plugin is free and open source. The official repository: https://github.com/jspreadsheet/plugins

Exporting using Jspreadsheet API

Alternatively, it is possible to export the spreadsheet using Jspreadsheet Api

Jsfiddle example