SmartQueryTools

Coalesce Columns in YAML Files Online

Fill null values in YAML files from other columns — return the first non-null value across up to 8 columns in priority order. Add the result as a new column. Runs entirely in your browser.

How to coalesce Columns in YAML files

  1. Drop your file onto the upload area. The first two columns are placed in slots 1 and 2 as a starting point, and the first 200 rows are shown.
  2. Set the columns in priority order. Slot 1 is checked first, then slot 2, and so on. Use "+ Add column" for up to 8 columns, or the cross to remove one.
  3. Name the output column. The default is "coalesced".
  4. Click Coalesce Columns. The new column is added at the end and every original column is kept.
  5. Check the preview and download the file in the same format you uploaded.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A sports club membership list has three phone columns filled in unevenly. The coach needs one phone number per member for a text alert, preferring mobile, then work, then home.

Input (YAML)

- member_id: M-01
  mobile: 021 555 0142
  work_phone: null
  home_phone: 09 555 7710
- member_id: M-02
  mobile: null
  work_phone: 04 555 3301
  home_phone: 04 555 9120
- member_id: M-03
  mobile: null
  work_phone: null
  home_phone: 03 555 6604
- member_id: M-04
  mobile: null
  work_phone: null
  home_phone: null

Settings

  • Columns (in priority order): 1. mobile, 2. work_phone, 3. home_phone
  • Output column name: contact_phone

Result

member_idmobilework_phonehome_phonecontact_phone
M-01021 555 0142NULL09 555 7710021 555 0142
M-02NULL04 555 330104 555 912004 555 3301
M-03NULLNULL03 555 660403 555 6604
M-04NULLNULLNULLNULL

Each row takes the first phone number that is present, checking mobile, then work_phone, then home_phone. M-01 has a home number too, but mobile wins because it is first. M-02 has no mobile, so the work number is used. M-04 has no numbers at all, so contact_phone is empty. The three source columns are left as they were.

Frequently Asked Questions

How many columns can I coalesce at once?

Between 2 and 8. The button stays disabled until at least two slots have a column picked.

Does coalesce change the original columns?

No. It adds one new column at the end and leaves every original column untouched. Drop the source columns afterwards with Manage Columns if you no longer need them.

Can I put a default value at the end of the chain?

Not in this tool, which only accepts columns. Run Fill Empty Values on the coalesced column afterwards to replace the remaining empty cells with a fixed value such as "unknown".

Related Tools

Fill Empty Values in CSV Files Online

Fill empty and null values in CSV files with a custom replacement value, directly in your browser.

Manage Columns in CSV Files Online

Drop or select specific columns from CSV files directly in your browser. No upload required.

Validate CSV Files Online

Validate CSV file structure in your browser. Check null counts, distinct values, and data types for every column — no upload required.

Coalesce Columns in CSV Files Online

Fill null values in CSV files from other columns — return the first non-null value across up to 8 columns in priority order. Add the result as a new column. Runs entirely in your browser.

Coalesce Columns in Excel Files Online

Fill null values in Excel files from other columns — return the first non-null value across up to 8 columns in priority order. Add the result as a new column. Runs entirely in your browser.

Coalesce Columns in Parquet Files Online

Fill null values in Parquet files from other columns — return the first non-null value across up to 8 columns in priority order. Add the result as a new column. Runs entirely in your browser.

Coalesce Columns in JSON Files Online

Fill null values in JSON files from other columns — return the first non-null value across up to 8 columns in priority order. Add the result as a new column. Runs entirely in your browser.

YAML Viewer Online

View and inspect YAML files directly in your browser. Browse rows, check column names and data types — no upload required, your data stays on your device.