HTML5 Export Buttons File Name Change
HTML5 Export Buttons File Name Change
clayleatherwood
Posts: 2Questions: 1Answers: 0
How can I change the name of the file that gets exported? I noticed in your example you have "DataTables example - HTML5 export buttons.xlsx" (or whatever extension). Where in the code do you go to put a different name in?
Here is the example I'm referring to: https://datatables.net/extensions/buttons/examples/html5/simple.html
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Use the
filename
option -excelHtml5
.Allan
Thank you so much Allan! That was an amazing help.
Here's the code I use to change the filename in the file exporting if this ends up helping anyone in the future:
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
{
extend: 'csv',
filename: 'pin_change_export'
},
{
extend: 'excel',
filename: 'pin_change_export'
}
]
} );
} );