Skip to main content

Posts

Showing posts from September, 2021

How to Specify Excel Data Formats in HTML

The Problem Suppose you have created an HTML page with a table and some data in it, and now you want to work with that data in Excel. Well, the good news is that Excel can open the HTML page and automatically parse the HTML and convert it into an Excel spreadsheet. Your data table will be automatically populated in Excel cells. The bad news is that if you have a cell with only numbers in it, for example, a serial number with leading zeros, like this: 000245689 . Excel will format it as number and remove the leading zeros. You will then have to add back the leading zeros and format it as text to preserve the leading zeros. However, not only it's a hassle having to add back the leading zeros, but it's not always possible to know how many leading zeros were in the original number, if you have 100 numbers with leading zeros all with different lengths. You could check the original HTML 1 by 1 but it's very time consuming. The Solution Well, it turns out

cusG_relatedPost_html