SmartQueryTools

Fill Empty Values in CSV Files Online

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

How to fill Empty Values in CSV files

  1. Drop your file onto the upload area. The tool counts the NULL values in every column and lists each column that has any, marked as numeric, text, or another type that is left as is.
  2. Type the replacement for text columns in Fill text nulls with. It starts empty, which fills with an empty string.
  3. To fill number columns too, tick Also fill numeric nulls and set the Numeric fill value. The default is 0.
  4. Click Fill Empty Values and check the preview.
  5. Click Download to save the filled 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 library exports its loan records for a monthly report. Missing renewal counts mean the loan was never renewed, and missing notes should read "none" rather than appearing blank.

Input (CSV)

branch,title,renewals,notes
Central,The Overstory,2,damaged cover
Eastside,Piranesi,,
Central,Klara and the Sun,0,
Northgate,,1,reserved

Settings

  • Fill text nulls with: none
  • Also fill numeric nulls: ticked
  • Numeric fill value: 0

Result

branchtitlerenewalsnotes
CentralThe Overstory2damaged cover
EastsidePiranesi0none
CentralKlara and the Sun0none
Northgatenone1reserved

Two notes and one renewal count were NULL, and they are now "none" and 0. The missing title is also "none": the text fill value applies to every text column that has NULLs, not only notes. Values that were already present, including the real 0 renewals for Klara and the Sun, are unchanged.

Working with CSV files

In a CSV, an empty field such as the gap in "Eastside,Piranesi,," is read as NULL, so blank cells are what this tool counts and fills. Leave the text fill value empty and a CSV download looks the same as before, because an empty string and a NULL are both written as an empty field. Use a visible placeholder such as N/A or unknown when the goal is to show that a value is missing. The per-column list shows how many blanks each column has before you fill, which doubles as a quick completeness check.

A column of ISO dates with some blank cells is detected as a date column. Only text and number columns are filled, so a date column keeps its blanks and the rest of the file is still filled. To fill blank dates with a placeholder such as N/A, cast the column to text with Cast Column Types first. The tool lists skipped columns before you run it.

Frequently Asked Questions

Why does my CSV look unchanged after filling nulls?

The text fill value was probably left empty. In a CSV, an empty string and a NULL are both written as an empty field, so there is no visible change. Enter a placeholder such as N/A instead.

Why were the blanks in my CSV date column not filled?

Only text and number columns are filled. Date columns are left as they are, because a text placeholder like N/A is not a valid date. Convert the column to text with Cast Column Types first if you want to fill it.

Are empty strings treated as missing?

No. Only NULL values are counted and filled. In CSV and Excel files, blank cells load as NULL, so they are filled. In Parquet and JSON, an empty string is a real value and is left alone.

Can I use a different fill value for each column?

No. There is one value for all text columns and one optional value for all numeric columns. Date, boolean and nested columns are not filled. For per-column values, use the SQL Query tool with COALESCE, or Coalesce Columns to fill from another column.

Are numeric columns filled by default?

No. Numeric NULLs stay NULL unless you tick Also fill numeric nulls. That is deliberate, because filling with 0 changes sums, averages and counts.

Related Tools