Search code examples
jqueryexport-to-excel

Providing custom filename is not working in table2excel jquery?


i have used jquery code to export table data into excel file, got code from here

but providing custome file name is not working it is taking random filename.
how to provide custom file name from code.

<script>
$(function() {
        $("button").click(function(){
        $("#example").table2excel({
                exclude: ".noExl",
        name: "Employee"
        }); 
         });
});
</script>

Solution

  • The name variable in this plugin refers to the name of the worksheet, not the name of the Excel file.

    If you want to be able to change the filename, you'll have to hack the plugin code a bit, or just use another plugin or piece of code that suits your needs, like this one (where you can put the filename in the postfix variable).