How to download a excel file from html using javascript ?

Table :

<table id=”mytable”>

Button :

<a download=”file.xls” href=”#” class=”btn-print” data-name=”#{mytable}”>
Download Excel File </a>

JavaScript :

    $('.btn-print').on('click', function() {
        var name = $(this).attr('data-name');
        return ExcellentExport.excel(this, 'mytable', 'title');

ExcellentExport :

Download the ExcellentExport and add the files in your project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s