7

Whenever you try to copy an HTML table to the pasteboard, it will select by row. Sometimes, I'd like to select by columns. Is there a way to do this? If not out of the box, any extensions that enable this kind of functionality.

5

As far as I know, there's no way to do that in Safari or Chrome, but in Firefox you can select ranges of cells by holding option and command.

You could also copy the whole table and paste it to a spreadsheet application or use something like pbpaste | cut -d $'\t' -f3. But it might not work if there are cells that contain br elements or rows that start with empty cells.

I've had to use something like this with a few tables that contained br elements:

ruby -e '`pbpaste`.scan(/<tr>.*?<\/tr>/m).each { |r| puts r.scan(/<td>(.*?)<\/td>/m)[2] }'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .