Export HTML table to excel using Javascript

Simply add this script to your web page:

<script src="https://cdn.dotmaui.com/p24/js/exportTableToExcel.min.js"></script>

To use it, call the exportTableToExcel() function specifying the table id as the first argument and optionally the file name as the second argument.

Example:

exportTableToExcel('mytable', 'my-excel-file');
exportTableToExcel('mytable');

To see the source of the exportTableToExcel() function view this paste.

Leave a Comment

Your email address will not be published. Required fields are marked *