Scenario: I am trying to export a html table to Excel file in a Web Application (website hosted online) for clients to download to their computers.
All data exported as expected, except 1 problem.
The HTML table web page is saved with file extension of XLS.
Below is the sample html page that saved as XLS file:
<html>
<head>
</head>
<body>
<table>
<tr><td>1/42</td></tr>
</table>
</body>
</html>
After openning this file in Excel (2019 version), the value of
1/42
is changed to
01/01/1942
and appears as
Jan-42
in Excel cell.
I have tried to prefix the value with single quote '
.
but then the value displays as
'1/42
in Excel cell.
How to make it appears as
1/42
correctly without the single quote and avoiding the Excel auto-reformatting it into Date, and without the need of changing the Excel cell Value format.
Is there anything that I can do during writing the HTML documents?