Search code examples
multiple-columnsopenrefinegrelremove-method

Is there a function in GREL to remove many columns at once based on their headers in OpenRefine?


I have a file with 76 columns, out of which 52 columns are irrelevant and should be removed based on their column headers (i.e. string of names). OpenRefine offers the possibility to manually Re-order/remove columns but I was wondering if there is a GREL way to match header names and remove many columns at once, as I was not able to find a remove function similar to replace.


Solution

  • If the columns that you want to remove are in sequence, you can use Transpose -> Transpose cells across columns into rows

    Then do the following:

    From Column: First column you want to delete

    To Column: Last column you want to delete

    Transpose Into: Two new columns

    • Set the Key column to anything - e.g. A
    • Set the Value column to anything - e.g B

    Now all of the columns you want to delete have been turned into rows and have been replaced by A and B. Finally, delete A and B and you're done.