How to Remove Blank Columns from a CSV File
3 methods — browser tool, Excel, and Python
Blank columns are a common byproduct of spreadsheet exports — extra empty columns at the end, columns that once had data but were cleared, or placeholder columns for fields not yet populated. They add noise to imports and clutter database schemas. Here's how to remove them.
Method 1: Using Tabular (browser, no software)
- 1Go to the Remove Empty Columns tool on Tabular.
- 2Upload your CSV or XLSX file.
- 3Click Run — any column where every cell is blank is deleted.
- 4Download the cleaned file.
Tabular only removes columns where ALL cells are empty. Columns with even one value are preserved. Use the Reorder Columns tool if you also want to selectively remove columns that have some data.
Method 2: Using Excel
- 1Open your CSV in Excel.
- 2Press Ctrl+End to jump to the last cell with data — this shows you how many columns Excel thinks your data has.
- 3Select any completely empty column by clicking its header letter.
- 4Right-click > Delete.
- 5Repeat for each empty column.
- 6Save as CSV via File > Save As.
If you have many empty columns at the end, select the first empty column header, then Shift+click the last one to select them all, then right-click > Delete.
Method 3: Using Python (pandas)
- 1Install pandas: pip install pandas
- 2Run the script below.
python
import pandas as pd
df = pd.read_csv("input.csv")
print(f"Before: {len(df.columns)} columns")
# Remove columns where ALL values are blank/NaN
df = df.dropna(axis=1, how="all")
# To also remove columns with header names like 'Unnamed: 0', 'Unnamed: 1':
# df = df.loc[:, ~df.columns.str.startswith("Unnamed")]
print(f"After: {len(df.columns)} columns")
df.to_csv("output.csv", index=False)Excel sometimes exports columns with 'Unnamed: 0', 'Unnamed: 1' headers for blank columns. The commented-out line above removes those too.
Frequently asked questions
What counts as a blank column?
A blank column is one where every data cell is empty — null, NaN, or an empty string. The column header itself may or may not exist. Tabular and pandas treat these as fully empty columns and remove them. Columns with even a single value are kept.
What if I want to remove columns that are mostly empty but not fully empty?
Use pandas with a threshold: df.dropna(axis=1, thresh=10) removes columns that have fewer than 10 non-null values. Adjust the threshold to your needs. In Tabular, use the Reorder Columns tool to manually select only the columns you want to keep.
Why does my CSV have extra blank columns after exporting from Excel?
Excel sometimes includes columns beyond your actual data range — particularly if you've ever entered and deleted data in those cells. Excel considers them 'used' even when empty. The Remove Empty Columns tool strips them out.
Can I also remove rows that are mostly empty at the same time?
Yes — run Tabular's Remove Empty Rows tool in sequence with Remove Empty Columns. Or in pandas: df.dropna(axis=0, how='all') removes blank rows, and df.dropna(axis=1, how='all') removes blank columns.
Ready to try the fastest method?
Delete columns with no data from your CSV or spreadsheet. Simplify your schema automatically.
Remove Empty Columns — free
Papiral
Tabular