JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.1.0/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/2.1.0/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.1.0/js/buttons.print.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.1.0/css/buttons.dataTables.min.css">
<table id="example" class="display nowrap" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td style='mso-number-format:"0.00%"'>12.23%</td>
<td>160.23%</td>
<td>10.263%</td>
<td>18.243%</td>
<td>10.29%</td>
<td>17.23%</td>
</tr>
</tbody>
</table>
JavaScript
$(document).ready(function() {
$('#example').DataTable({
dom: 'Bfrtip',
filename: "abc",
buttons: [{
extend: 'excelHtml5',
text: 'Excel',
customize: function(xlsx) {
//Get the styles sheet
let styles = xlsx.xl['styles.xml'];
// Create a style which uses numFmtId=10, this is the format for percentage with 2 decimal places
let style = '<xf numFmtId="10" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>';
// Get the current cellXfs
let cellXfs = $('cellXfs', styles);
// Append the style to cellXfs, and update the cellXfs count attribute
cellXfs.append(style);
cellXfs.attr('count', $('xf', cellXfs).length);
// Get sheet 1 and apply the new style, skipping first two rows
let sheet = xlsx.xl.worksheets['sheet1.xml'];
$('row:gt(1) c', sheet).attr('s', $('xf', cellXfs).length - 1);
}
}]
});
});