Table :
<table id=”mytable”>
{…}
</table>
Button :
<a download=”file.xls” href=”#” class=”btn-print” data-name=”#{mytable}”>
Download Excel File </a>
JavaScript :
<script> $('.btn-print').on('click', function() { var name = $(this).attr('data-name'); return ExcellentExport.excel(this, 'mytable', 'title'); }); </script>
ExcellentExport :
Download the ExcellentExport and add the files in your project.