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://jexcel.net/v7/jexcel.js"></script>
<script src="https://jexcel.net/v7/jsuites.js"></script>
<link rel="stylesheet" href="https://jexcel.net/v7/jexcel.css" type="text/css" />
<link rel="stylesheet" href="https://jexcel.net/v7/jsuites.css" type="text/css" />

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

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

<script>
mySpreadsheet = jexcel(document.getElementById('spreadsheet'), {
    csv: '/jexcel/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: 'YjQzMzdlOTRiOGY3ZTQ0ZDQ4ZTI1YWU3MDFjMDI0ZWJmOTNjODA1NWFiZTRiNDJhNmRiYTJlZjkwODQ3N2IwMWRmNWRjYWUwZDViM2VhMmI3NzVjOTcwMzVlN2ZhODI1Y2EyMmE3NDI0ZmE0ZjVmNGQ2MWEzN2M3MTA4MThhMDUsZXlKdVlXMWxJam9pY0dGMWJDNW9iMlJsYkNJc0ltUmhkR1VpT2pFMk16SXdPVEkwTURBc0ltUnZiV0ZwYmlJNld5SnFjMlpwWkdSc1pTNXVaWFFpTENKcVpYaGpaV3d1Ym1WMElpd2lZMjlrWlhOaGJtUmliM2d1YVc4aUxDSnFjMmhsYkd3dWJtVjBJaXdpTVROemQyMHVZM05pTG1Gd2NDSXNJbXh2WTJGc2FHOXpkQ0pkTENKd2JHRnVJam9pTXlKOQ==',
});
</script>
</html>


Other properties related

Property Description
csvFileName Default filename when the user download the table content. Default: 'jexcel.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