Thousands Separator in Datatable wrong display in excel

Software Used:

Datatables 1.10.20

Datatable Display:


When it exported to Microsoft Excel then JUMLAH column displayed with wrong format like image below:


How to fix it … ?


We can make this code below:

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


  • if(column===2) , this code check if column index is 2
  • data.replace(/./g, ‘,’) this code is replacing dot with comma and Microsoft Excel will change comma to dot

Thanks for reading

You may also like...

Leave a Reply

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