← CSV Repair & Deduper (offline browser tool)

How to combine (concatenate) multiple CSV columns into one column

Merging separate columns like first/last name or address parts into a single combined field, and handling blanks along the way.

Before you work through this by hand: you can check your own CSV free and see which of these problems your file actually has — duplicate rows, near-duplicates, broken quoting, encoding damage. It runs in your browser tab, nothing is uploaded, and there's no signup or email.

The simple case: a spreadsheet formula

In Excel or Google Sheets: =A2 & " " & B2 combines two cells with a space between them (use CONCAT() or TEXTJOIN() for more than two columns at once). TEXTJOIN(", ", TRUE, A2:D2) is especially useful for address parts, since the second argument (TRUE) skips blank cells instead of leaving stray extra separators.

The pandas equivalent

import pandas as pd; df = pd.read_csv('file.csv'); df['full_name'] = df['first_name'] + ' ' + df['last_name'] — note this produces NaN for the whole result if either input column is blank for that row, which is usually not what you want.

Handling blank columns without breaking the result

df['full_name'] = df['first_name'].fillna('') + ' ' + df['last_name'].fillna('') — filling missing values with an empty string first avoids the whole combined field becoming blank just because one part was missing. For more columns, df[['first_name','middle_name','last_name']].fillna('').agg(' '.join, axis=1) joins any number of columns while skipping this trap consistently, though you may still end up with extra spaces where a middle field was blank — worth a follow-up trim pass (see our whitespace-trimming guide).

Why you might want this before deduplication

Sometimes the reverse of our column-splitting guide is what you need: combining fields into one normalized key column makes it easier to compare records for duplicates when the same information is split differently across two data sources.

$19 one-time payment. No subscription. If you'd rather skip the manual steps above, CSV Repair & Deduper (offline browser tool) automates the duplicate-finding and review step for you, entirely on your own device.

See CSV Repair & Deduper (offline browser tool) — $19 one-time

See all free guides