Export Datatable Number with Comma Decimal to Excel

Software Used:

Datatables 1.10.20

Datatable Display:


When i export to excel then decimal format in QTY column is wrong like image below:


How to fix this … ?


We can use this code below:

  buttons: [
	extend: 'excel',
	exportOptions: {
           columns: ':visible',
           format: {
                    body: function(data, row, column, node) {
			   return data.replace(',', '.');
			else return data


  • if(column===1) , this code check if column index is 1
  • data.replace(‘,’, ‘.’) this code replace comma with dot and Mirosoft Excel will change dot to comma

Thanks for reading

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *