As I said in my NFL Playoff post, here is a brief description on how to convert an Excel worksheet into a simple HTML table.
What makes this tricky is that Excel tries to preserve all of the formatting from Excel in the HTML file, which adds an enormous amount of clutter that you do not need.
Here is what to do:
The Really Short Version
Save the worksheet as a “Single File Web Page”. Open it up in a text editor and erase everything above the <table> tag and below the </table> tag. Erase all of the attributes in the remaining tags.
The Longer And More Detailed Version
- Go to File, Click Save As.
- In the “Save as Type” drop box, choose the format “Single File Web Page (*.mht,*mhtml)”.
- Click Save.
- Click “Yes” in the pop up box to lose formating.
- Find the file where you saved it.
- Open it in a text editor like Notepad, though I highly recommend getting the free Notepad++
- Man there is a lot of code. Don’t worry. Just Search for the string “<table”. This is where the actual data from the worksheet is. It should contain a lot of <tr> and <td> tags. You should be able to spot your actual data inside the <td> and </td> tags.
- Erase all of the code before “<table”.
- Search for “</table”.
- Erase all of the code after “</table … > full tag.
- Erase all of the attributes inside all of the remaining tags such as “width=” and “style=”. A good short cut at this point is to a find and replace for what you are trying to erase and replace it with nothing since it is repeated in many of the tags.
That should do it.
Related books picked – and if possible read – by me. Sponsored by Amazon Associates.