I want to export a html table to Excel.
Table:
<div id="table">
<table>
<thead>
<tr>
<th>Column</th>
<th>Column</th>
</tr>
</thead>
<tbody id="tabbodyExp">
<tr>
<th>2.5</th>
<th>2.6</th>
</tr>
</tbody>
</table>
</div>
Script:
$("#btnExport").click(function (e) {
window.open('data:application/vnd.ms-excel,' + $('#table').html());
e.preventDefault();
});
But excel is turning all numbers that are written like that "2.5" to Dates. Is there a way to stop that or do I have to write all number like that "2,5".