Export Table to Excel, Problems with String Numeric

Asked

Viewed 360 times

2

I looked here in Stack, but maybe I did not find the right question, I am exporting data from PHP to Excel with HTML tags, it exports in a good way, I happen to have a column that is String, for example "89551010326000103872"but Excel insists on transforming in number ending up with my data see "8,95510103260001E+19" I tried to put (String)$Data to force the use of string, but as expected it did not help

A row of the table is about that

...
<table> 
<tr>
<td>89551010326000103872 </td>
<td>CONTROLE</td>
</tr> 
</table> 
...

Is there anything I can put in TD for excel to understand that it is a String and not number?

1 answer

1

To escape a number in a cell as a string, you can put a simple quotation mark at the beginning of the cell, so it would look like this:

...
<table> 
<tr>
<td>'89551010326000103872 </td>
<td>CONTROLE</td>
</tr> 
</table> 
...
  • But then he’ll get that quote at the beginning of the number, in my case I can’t leave it like this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.