Format HTML table cell so that Excel formats as text?

You can apply formatting to the cells for numbers, text, dates, etc.

See my previous answer on this: HTML to Excel: How can tell Excel to treat columns as numbers?

(adjusted snippet)

If you add a CSS Class to your page:

.num {
  mso-number-format:General;
}
.text{
  mso-number-format:"\@";/*force text*/
}

And slap those classes on your TD’s, does it work?

<td class="num">34</td>
<td class="num">17.0</td>
<td class="text">067</td>

Leave a Comment