Create a javascript spreadsheet from a CSV file

The example below helps you to create a javascript spreadsheet table based on a remote CSV file, including the headers.

NOTE: A download can be performed by CTRL+S or by the option save available in the context menu.



Source code

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

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

<p><button onclick='mySpreadsheet.download();'>Export my spreadsheet as CSV</button></p>

<script>
mySpreadsheet = jspreadsheet(document.getElementById('spreadsheet'), {
    csv: '/jspreadsheet/arts.csv',
    tableOverflow: true,
    columns: [
        { type: 'text', width: '300px' },
        { type: 'text', width: '80px' },
        { type: 'dropdown', width: '120px', source: ['England','Wales','Northern Ireland','Scotland'] },
        { type: 'text', width: '120px' },
        { type: 'text', width: '120px'},
     ],
     license: 'MWEzMTE4MGFkNWY5YzQzNjE4NjZiNmE1NThhM2M0Yjc1NmUyNGM2N2YzZjU2NDQ5ZjM1MGFiYWNmOTFkNTkwODFiYmYwNDE1YjhhM2ViNGUyMzM2YjYzY2Q4NTcyMWE4MGQ4YjVjNjI2NWY4NWYyMTBjMWU5M2ZmNTU4OGI1MDQsZXlKdVlXMWxJam9pY0dGMWJDNW9iMlJsYkNJc0ltUmhkR1VpT2pFMk5UZzVOakk0TURBc0ltUnZiV0ZwYmlJNld5SnFjM0J5WldGa2MyaGxaWFF1WTI5dElpd2lZM05pTG1Gd2NDSXNJbXB6YUdWc2JDNXVaWFFpTENKc2IyTmhiR2h2YzNRaVhTd2ljR3hoYmlJNklqSWlMQ0p6WTI5d1pTSTZXeUoyTnlJc0luWTRJaXdpY0dGeWMyVnlJaXdpYzJobFpYUnpJaXdpWm05eWJYTWlMQ0p5Wlc1a1pYSWlMQ0ptYjNKdGRXeGhJbDE5',
});
</script>
</html>


Other properties related

Property Description
csvFileName Default filename when the user download the table content. Default: 'jspreadsheet.csv'
csvHeaders Consider the first line in the CSV as the header names. Default: true
csvDelimiter Consider the first line in the CSV as the header names. Default: ,
allowExport Allow the user to export by CTRL+S or by the contextMenu. Default: true