HomeGuidesHow to Find and Replace Text in a CSV File
Guide

How to Find and Replace Text in a CSV File

3 methods — browser tool, Excel, and Python

Find and replace in a CSV lets you fix typos, standardize values, update product codes, or swap old values for new ones across an entire file at once. Here are the three most common ways to do it.

Method 1: Using Tabular (browser, no software)

  1. 1Go to the Find & Replace tool on Tabular.
  2. 2Upload your CSV or XLSX file.
  3. 3Enter the text to find and the replacement text.
  4. 4Choose whether to match the whole cell or any occurrence within a cell.
  5. 5Optionally restrict the operation to specific columns.
  6. 6Click Run and download the result.

Tabular's find and replace is case-sensitive by default. To replace both 'USA' and 'usa', run it twice or normalize casing first with the Normalize Casing tool.

Method 2: Using Excel

  1. 1Open your CSV in Excel.
  2. 2Press Ctrl+H (Windows) or Cmd+H (Mac) to open Find & Replace.
  3. 3Enter the Find what and Replace with values.
  4. 4Click Options to restrict to a specific sheet or to match the entire cell contents.
  5. 5Click Replace All.
  6. 6Save as CSV via File > Save As.

Excel's Find & Replace is case-insensitive by default. Check 'Match case' in Options if you need case-sensitive replacement.

Method 3: Using Python (pandas)

  1. 1Install pandas: pip install pandas
  2. 2Run the script below.

python

import pandas as pd

df = pd.read_csv("input.csv")

# Replace in entire dataframe
df = df.replace("old value", "new value")

# Replace in a specific column only
# df["column_name"] = df["column_name"].str.replace("old", "new", regex=False)

# Replace using regex
# df = df.replace(r"\bUSA\b", "United States", regex=True)

df.to_csv("output.csv", index=False)

Use regex=False for plain text replacements to avoid accidentally matching regex special characters like dots or brackets.

Frequently asked questions

Can I use find and replace across all columns at once?

Yes — all three methods above can replace across every column in the file. In Tabular, leave the column selector empty to search all columns. In Excel, Find & Replace searches all cells by default. In pandas, df.replace() applies to the entire dataframe.

How do I replace a value only in a specific column?

In Tabular, select the specific column from the dropdown before running. In Excel, select just that column before opening Find & Replace. In pandas, use df['column_name'].str.replace() instead of df.replace().

Can I replace empty cells with a value?

In pandas, use df.fillna('replacement') to replace blank/NaN cells. In Excel, use Find & Replace with the Find what field left empty to find blank cells. In Tabular, use the Fill Empty Cells tool which is specifically designed for this purpose.

How do I do a case-insensitive find and replace in a CSV?

In pandas, use df.replace(re.compile('pattern', re.IGNORECASE), 'replacement', regex=True). In Excel, uncheck 'Match case' in the Find & Replace options — it's case-insensitive by default.

Ready to try the fastest method?

Find any text in your CSV and replace it across an entire column or the whole file — bulk editing made easy.

Find & Replace — free