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/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" />

<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: 'NGEyZjEyMzY1NmM2MmE5MjAzOTFjMWZkNzFhMTYyM2U0ZmY2NDVmNzM4YTExOTBmMWY0ODM5NDgyNGRjNWVmODJjMjU4MWIyNjlhMzk2ZDRlODUwOWJlN2UwZDJlOTk3MDk5ZjA4ZmE0NTg3ZjEzNTVlYjA3NDhjNzFiMDIyYTgsZXlKdVlXMWxJam9pU25Od2NtVmhaSE5vWldWMElpd2laR0YwWlNJNk1UY3hNVGM1TnpFd015d2laRzl0WVdsdUlqcGJJbXB6Y0hKbFlXUnphR1ZsZEM1amIyMGlMQ0pqYjJSbGMyRnVaR0p2ZUM1cGJ5SXNJbXB6YUdWc2JDNXVaWFFpTENKamMySXVZWEJ3SWl3aWQyVmlJaXdpYkc5allXeG9iM04wSWwwc0luQnNZVzRpT2lJek5DSXNJbk5qYjNCbElqcGJJblkzSWl3aWRqZ2lMQ0oyT1NJc0luWXhNQ0lzSW1Ob1lYSjBjeUlzSW1admNtMXpJaXdpWm05eWJYVnNZU0lzSW5CaGNuTmxjaUlzSW5KbGJtUmxjaUlzSW1OdmJXMWxiblJ6SWl3aWFXMXdiM0owWlhJaUxDSmlZWElpTENKMllXeHBaR0YwYVc5dWN5SXNJbk5sWVhKamFDSXNJbkJ5YVc1MElpd2ljMmhsWlhSeklsMHNJbVJsYlc4aU9uUnlkV1Y5',
});
</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