How to copy HTML tables to MS Excel

A quite simple question, really, but I’ve had some trouble with it today.

Basically, the answer depends on your browser:

  • Internet Explorer (at least the v9.0.2 that I have) allows you to copy an HTML table with Ctrl-C and paste it directly into Excel with Ctrl-V. All data, including hyperlinks and images will be copied to Excel, which can become a problem if you only want text data.
  • Mozilla Firefox (I have the v6.0.2) isn’t on speaking terms with the MS Office, so when you try to copy-paste HTML tables into Excel, you get it all crammed into a single cell. There is a trick, however: copy-paste the table from Firefox to Notepad. This will create a tab-separated “table”, which can be then copy-pasted to Excel (at least the Excel 2007 SP2). This will strip the data off hyperlinks, formatting, and images (replaced by alt-texts), however.

So there. Depending on whether you want to preserve the formatting or get rid of it, you should take one browser or the other.

This entry was posted in html, ms office. Bookmark the permalink.