Bulk Editing in OpenRefine

If you're working with a codebook list of numeric codes you want to translate to their human-readable values, you can speed up the replacement by making yourself a spreadsheet to autofill the OpenRefine code.

 

You will need your list of numeric codes in one column and your list of human-readable values in another column, plus the name of the column where these values are going to be replaced.

This file is a template for batch replacing one value with another value.  In ColumnName, enter the name of the column where your values live.  Code to Replace is your numeric code from the codebook, and Replacement Text is your human-readable value.

 

Column H has a concatenation formula =CONCATENATE(A2,B2,C2,D2,E2,F2,G2), which puts all your code and column values together to create a JSON code string to tell OpenRefine what to do.  Fill in the columns B, D, and F with as many items as you need to replace, and drag A, C, E, G, and H to fill down.

Copy all of column H and paste it into a text editor like Atom or TextWrangler.  Before the first item, include a square bracket [, and after the last item type another closing square bracket ]

 

Save this file as transforms.json (JSON is the file format)

In your OpenRefine project, select Undo/Redo > Apply

In the window, paste the text from transforms.json and click Perform Operations.  Depending on how many items you're editing, this may take a while, but when done your batch edits should be complete!