CSV Coalesce Columns

Build one column from the first non-empty value across several columns, read in the priority order you list. Optionally drop the sources and set a fallback. Runs entirely in your browser, no upload.

Try:
Coalesced CSV

CSV coalesce columns

Build one column from the first non-empty value across several columns, read in the priority order you list them — the SQL COALESCE idea applied to columns instead of expressions. It's the fastest way to fold mobile/office/home into a single phone, or a web price with a list-price fallback, without writing a spreadsheet formula. Optionally drop the source columns, choose where the new column lands, and set a fallback for rows where every source is empty. Runs entirely in your browser; nothing is uploaded.

Worked example

Input — three phone columns, filled in unevenly:

name,mobile,office,home
Ann,555-1,555-2,555-3
Bob,,555-4,555-5
Cleo,,,555-6

Source columns mobile,office,home, new column name phone → output:

name,mobile,office,home,phone
Ann,555-1,555-2,555-3,555-1
Bob,,555-4,555-5,555-4
Cleo,,,555-6,555-6

Ann keeps her mobile (first in the priority list), Bob falls through to the office number, Cleo all the way to home. Turn on Drop the source columns and set the position to where the first source column was to get the tidy version instead:

name,phone
Ann,555-1
Bob,555-4
Cleo,555-6

Options

Limits & edge cases

FAQ

How is this different from concatenating or merging columns?

Concatenating joins every value together (555-1 / 555-2). Coalescing picks exactly one — the first source that has a value for that row — and ignores the rest. Use it when the columns are alternatives for the same fact, not parts of one.

What counts as an empty cell?

A zero-length cell always counts. With Treat whitespace-only cells as empty on (the default), a cell holding only spaces or tabs counts too. Anything you list under Extra placeholders that count as empty — for example NULL,NA,N/A,- — also counts, compared case-insensitively after trimming, so n/a and N/A both match.

Can I keep the original columns?

Yes — that's the default. The new column is added alongside them, so you can check the result before deleting anything. Turn on Drop the source columns only when you want them replaced; other columns are always kept in their original order.

Does it work without a header row?

Yes. Switch First row is a header off and address columns by 1-based index (2,3,4). Every row is then treated as data, and the coalesced column is added without a header cell.

Is my data uploaded?

No — the CSV is processed locally with WebAssembly. Nothing leaves your browser.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool csv-coalesce-columns "name,mobile,office,home
Ann,555-1,555-2,555-3
Bob,,555-4,555-5
Cleo,,,555-6" 'columns=mobile,office,home'

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/csv-coalesce-columns/?data=name%2Cmobile%2Coffice%2Chome%0AAnn%2C555-1%2C555-2%2C555-3%0ABob%2C%2C555-4%2C555-5%0ACleo%2C%2C%2C555-6&columns=mobile%2Coffice%2Chome&output=phone&position=end&fallback=N%2FA&drop_sources=true&blank_is_empty=true&null_tokens=NULL%2CNA%2CN%2FA%2C-&header=true&delimiter=%2C

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.