A compilation of OpenRefine GREL Recipes for manipulating data.
value.slice(8, 10) + "/01/" + value.slice(24, 30)
value.slice(0, 10) + " 00:00:00"
now().slice(0, 10) + " 00:00:00"
diff(date 1, date 2, 'format')
Returns the difference between 'date 1' and 'date 2' in the format (months, days, etc.) specified
value.replace("str1", "str2")
The first parameter is what searched for and the second parameter is what the first parameter is replaced with.
value.replace(' ','')
Replaces blank spaces with no space.
value.replace("''"," ")
Replaces quotations with blank space (NOTE: double quotations must be used on the outside.)
value.floor().toString()
cells["Column1"].value
The array contains the name of the source cell and "value" is its value
cells['Column1'].value + cells['Column2'].value
cells['Column1'].value + 'str1'
value.splitByCharType[0]
Returns the first element of a string based on the character type
value. == cells['Column1'].value
value.contains('str1')
Checks if the value contains "str1"
value.startsWith('str1')
Checks if the value starts with "str1"
value.endsWith('str1')
Checks if the value ends with "str1"