Is There An Easy Way To Export Database Resultset To Excelsheet?

Asked by Anonymous on 22 Apr 2018 4484 Views

Anonymous on 23 Apr 2018


Download the js files listed below that has got all the necesarry blocks of codes you need to be able to export an HTML table to excelsheet and add links to those js files in your page.

Create a button for download and give it an id button and give the id myTable to your table. You can replace those ids with the ones you prefer.

Once you have done that, add this script in your view file and declare the class or id names you defined for the button and the table and you are done.

 
<script type="text/javascript"> 
    $("#button").click(function() { 
        $('#myTable').tableExport({ 
            type : 'excel', 
            escape : 'false', 
            ignoreColumn: [] // add column names as array here if you need to exclude any of them 
        }); 
    }); 
</script>   

Download js files from here.

export.js

base.js


You must be logged in to answer a question. or