Search code examples
openrefine

enumerate the values of a range in google refine / openrefine


I have an OpenRefine column with a sequence of identifiers. Some are single integers (22, 27) and some represent a range (28-33, 10023-10110). I'm looking for a way to make each number in that range explicit, so I can then make each value its own row.


Solution

  • Here's the basic technique:

    1. Split the range identifiers into two columns: Id1 and Id2.
    2. Create a new column based on Id2 with this expression

      forRange(cells.Id1.value,cells.Id2.value+1,1,x,x).join(",")

    3. Then click "Edits Cells" on the new column and pick "Split multi-valued cells". This will create new rows for the range.

    4. if you want to populate the data for the new rows click "Edit Cells" and "Fill Down" on each of the data columns.