Skip to main content

OpenRefine for Journalists: Cleaning Data

Tame messy datasets — inconsistent names, stray spaces, muddled formats — with OpenRefine's faceting, clustering and GREL, all running privately on your own machine.

Last reviewed: Next review due:

1. What OpenRefine is

OpenRefine is a free, open-source tool built for one job spreadsheets do badly: finding and fixing inconsistencies in messy data. You work in a browser, but it runs entirely on your own computer at an address like 127.0.0.1:3333, so your data never leaves the machine unless you choose to use an external service. That local-first design makes it a favourite for sensitive and investigative material.

Download it from openrefine.org. It is the tool to reach for when a column contains “Manchester City Council”, “Manchester CC” and “MCC” that all mean the same body.

2. Importing your data

Start a new project from a CSV, TSV, Excel, JSON or XML file. OpenRefine shows a preview so you can confirm the delimiter, the header row and the encoding before it creates the project.

  • 1Create Project, then choose your file and check the preview parses the columns correctly.
  • 2Confirm the character encoding -- UK data is usually UTF-8, but older exports may be Windows-1252.
  • 3Untick 'parse cell text into numbers' at first if you want full control over types later.
  • 4Name the project clearly; OpenRefine keeps it in its own workspace so your original file is never altered.

3. Faceting to see what is really there

A text facet lists every distinct value in a column with a count. On a supplier or authority column it exposes the variants hiding in thousands of rows. Click a value to filter to those rows, fix them, and the facet refreshes.

Open the column menu, then Facet > Text facet. Numeric facets (Facet > Numeric facet) reveal outliers — a negative payment, a date in the wrong century, an amount with a stray decimal. Faceting turns cleaning into a systematic sweep rather than guesswork.

4. Clustering inconsistent values

Clustering is OpenRefine's signature feature. Inside a text facet, click Cluster and it groups values that are probably the same thing spelled differently, ready for you to merge each group to one agreed form.

  • Key collision with fingerprinting ignores case, punctuation and word order -- catching 'Manchester City Council' and 'Council, Manchester City'.
  • Nearest-neighbour methods catch typos and near-misses such as 'Manchester City Cncl'.
  • You review each cluster and approve a single merged value; nothing changes without your say-so.

This collapses hours of find-and-replace into minutes, and — crucially — you stay in control of every merge.

5. Text transformations with GREL

GREL (the General Refine Expression Language) is a small formula language for transforming cells. Use Edit cells > Transform, then write an expression that previews live against your real data before you apply it.

value.trim()                      // strip leading/trailing spaces
value.toUppercase()               // standardise case
value.replace("Ltd.", "Ltd")      // tidy a suffix
value.replace(/\s+/, " ")         // collapse repeated spaces

A handful of functions — trim, replace, toUppercase, toTitlecase— fixes the great majority of messy columns without touching a full programming language.

6. Splitting and joining columns

Real data often crams several fields into one cell, or scatters one field across many. OpenRefine splits and joins columns from the column menu, or with a GREL expression when you need to combine values.

// join a first and last name column into one full-name column
cells["First"].value + " " + cells["Last"].value

// take the postcode area (the letters before the first digit)
value.match(/([A-Z]+).*/)[0]

For simple cases use Edit column > Split into several columns (choose a separator such as a comma) and Join columns to reverse it.

7. Reconciling against external identifiers

Reconciliation matches your messy text to entries in an external database, attaching a stable identifier. Point a name column at a reconciliation service — OpenRefine ships with support for Wikidata — and it proposes matches with confidence scores for you to confirm.

For journalism this can turn a column of company or place names into linked, unambiguous entities, ready to join to other datasets. Treat every automatic match as a suggestion to verify, not a fact: confirm the high-confidence ones and review the rest by hand.

8. The operation history for reproducibility

Every step you take is logged in the Undo / Redotab, and you can extract that log as a JSON list of operations — a complete, auditable record of how the raw data became the clean data.

  • Open Undo / Redo, then Extract to copy the operations as JSON; save it beside your project.
  • When an updated dataset arrives, import it and use Apply to replay every step automatically.
  • A monthly refresh becomes a two-minute job instead of a full re-clean.
  • If an editor queries a figure, the history shows exactly which transformations produced it.

9. Exporting cleaned data

When the data is clean, use the Exportmenu (top right) to write out CSV, TSV or Excel for the next stage — a spreadsheet, R, a database or a chart tool. Export the whole project too if you want a colleague to pick up your work with the history intact.

Keep the original download untouched. Your clean export plus the saved operation history is a tidy, reproducible package you can defend and hand on.

10. Red flags

  • Merging clusters too aggressively -- two similarly named councils may be genuinely different bodies; check before you approve.
  • Trusting a reconciliation match without verifying it; confidence scores are suggestions, not proof.
  • Cleaning in place and losing the original -- always keep the raw download and let the history be your record.
  • Letting OpenRefine auto-parse numbers, then finding leading zeros or codes silently mangled.
  • Forgetting the wrong encoding turns pound signs and accents into gibberish; set UTF-8 on import.

Cleaning checklist

  • I have imported with the correct delimiter and UTF-8 encoding, and kept the raw file untouched.
  • I have faceted every key column to see the real range of values.
  • I have clustered inconsistent names and reviewed each merge before approving it.
  • I have trimmed spaces and standardised case with GREL where needed.
  • I have verified any reconciliation matches rather than trusting them wholesale.
  • I have extracted the operation history as JSON and exported the clean data.

Get the data

Council spending returns and other UK disclosures are famously inconsistent — exactly what OpenRefine fixes. Browse sources, or file an FOI when the data is not published.

Related guides

Frequently asked questions

What is OpenRefine and does it upload my data anywhere?
OpenRefine is a free, open-source tool for cleaning and reshaping messy datasets. Although you work in a web browser, the whole thing runs locally on your own machine at an address like 127.0.0.1:3333, so your data never leaves the computer unless you deliberately use an external reconciliation service. That makes it safe for sensitive or leaked material, and it is one of the reasons investigative teams favour it. You download and run it yourself; there is no cloud account and no login. Think of it as a spreadsheet built specifically for finding and fixing inconsistencies rather than for calculation.
What are facets and how do they help me clean data?
A facet is a live summary of the distinct values in a column, shown in a side panel. A text facet on a supplier column instantly reveals that Manchester City Council also appears as Manchester CC, Man City Council and MCC -- variations that would be invisible scrolling through thousands of rows. You click a value to filter to just those rows, edit in place, and the facet updates. Numeric facets show distributions and outliers; you can spot a rogue negative amount or a date in the wrong century. Facets turn cleaning from guesswork into a systematic sweep of what is actually in each column.
What does clustering do?
Clustering automatically groups values that are probably the same thing spelled differently, then lets you merge each group to one agreed form in a couple of clicks. OpenRefine offers several methods: key collision techniques such as fingerprinting ignore case, punctuation and word order, while nearest-neighbour methods catch typos and near-misses. For a council column, clustering might gather Manchester City Council, Manchester CC and Manchester City Cncl into one cluster you rename consistently. You stay in control -- nothing merges without your approval -- but it collapses hours of manual find-and-replace into minutes, which is why it is OpenRefine's signature feature.
What is GREL and do I need to learn to code?
GREL, the General Refine Expression Language, is a small formula language for transforming cells, much like spreadsheet formulas. You do not need it for basic cleaning -- faceting and clustering handle a lot -- but a few expressions go a long way. value.trim() strips stray spaces, value.toUppercase() standardises case, and value.replace() swaps text. You can combine columns, extract part of a string, or parse a date. Expressions preview live against your real data before you apply them, so you see the effect on every row first. Learn five or six functions and you can fix the great majority of messy columns without ever touching a full programming language.
How does OpenRefine keep my cleaning reproducible?
Every action you take is recorded as a step in the Undo/Redo history, and that history can be exported as a JSON list of operations. Save it alongside your project and you have a complete, auditable record of exactly how the raw data became the clean data -- invaluable if an editor or a subject queries a figure. Better still, you can apply that same JSON to a fresh copy of an updated dataset to replay every step automatically, so a monthly refresh is a two-minute job rather than a full re-clean. Keep the original download untouched and let the history be your reproducible script.