Unnest

One cell holds three answers. Unnest turns that cell into three rows.

What it does

Some columns pack many values into one cell. Survey answers, product tags, and skill lists often look like this.

Unnest cuts the cell at a delimiter. It then writes one row for each piece. The other columns repeat on every new row.

Before

response_idcitytopics
1Bengalurutraffic,parks,water
2Chennaibuses

After, split on a comma

response_idcitytopics
1Bengalurutraffic
1Bengaluruparks
1Bengaluruwater
2Chennaibuses

Two rows became four. Now you can count each topic, or filter on one topic.

Split a column into rows

  1. Type unnest in the Search transforms box, in the Pipeline panel.
  2. Select Unnest in the results.
  3. Open Select column. Search for the column and click it.
  4. Type the separator in the Delimiter box. Use , for a comma.
  5. Click Apply.

The step appears in your pipeline with edit and delete buttons.

Things to know

  • An empty Delimiter box means a comma. Type the character when your file uses ; or |.
  • The delimiter can be more than one character. A value such as - works.
  • A row with an empty cell in that column disappears. There is nothing to split.
  • The column keeps its position in the grid.
  • Spaces stay. The value traffic, parks gives parks with a leading space.

Tips

For SQL users

Unnesting topics on a comma runs as:

SELECT "response_id", "city", UNNEST(STRING_SPLIT("topics", ',')) AS "topics" FROM "survey"
Try Unnest with sample data →

Related Operations