26.9.11

Transpose columns across rows (grefine 2.5)


This article was previously name JSON code to transpose important number of columns. With Google Refine 2.5, the transpose function have been remodel with nice usability improvement. If you are using google refine 2.1 or an earlier version please refer to this article.

You might want to transpose from columns to rows numbers of columns, when you split your column to columns. You can also refer to the section 5 of David's tutorial for details on the transpose function.

Now you can transpose and large number of column right within the interface.




Options:
Three options are available:
  • "prependColumnName": false, so data remains the same. You can use this option to track from which column comes from each new row (sometimes it's useful)
  • "ignoreBlankCells": true, so no extra lines are added if a cell is blank
  • "Fill down in other columns": if you tick it, all others columns will be filled down so all your rows contains data. If you wish create records, untick this option.

How it works?

The following data set:
A 1 2 3
B 1 2 3
C 1 2 3

will be transform into
A 1 2
A    3
B 1 2
B    3
C 1 2
C    3

and then into
A 1
A 2
A 3
B 1
B 2
B 3
C 1
C 2
C 3