Copy and Paste from HTML Tables with Empty Cells

Problem

You would like to copy a HTML table into a spreadsheet processing application like Google Spreadsheets.

However, the table you would like to copy contains empty cells. Just as in the ‘Start_Time’ column in the image shown below:

If you paste this table, the rows which contain empty cells are not copied correctly. The empty cells are simply omitted and thus the later column headings do not match the cell values correctly.

Solution

You can solve this problem easily when you have some influence on the rendering of the HTML table in question.

Just place in any empty cell the character  

For instance, instead of creating cells such as

<td></td> or

<td> </td>

Represent empty cells as:

<td>&nbsp;</td>

Background

As can be seen in the first screenshot, I’ve been working on a tabular data view for hyperdata on Appjangle. This view should make it easier to analyse structured and semi-structured data. In the example above, data created using the web time reporter is to be analyzed using Google Spreadsheets.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s