How to Analyze a CSV File with ChatGPT Data Analysis
Upload a spreadsheet and let ChatGPT run Python to clean it, compute summaries, and answer questions about your data.
ChatGPT's data analysis feature runs real Python in a sandbox, so it can load a spreadsheet, clean it, and compute exact answers rather than estimating. This is far more reliable than asking it to eyeball numbers. This guide walks through uploading a sales CSV and getting trustworthy summaries from it.
What you need
- A ChatGPT account with file upload available
- A CSV or Excel file (a few columns and rows is enough to start)
- A question you want answered about the data
Step 1: Upload the file
Start a chat, click the + (attach) button in the message box, and select your CSV. ChatGPT detects it is data and prepares to analyze it. You can drag the file straight into the input box too.
Step 2: Ask it to inspect the structure first
Before any analysis, ask ChatGPT to show the columns, data types, and the first few rows. This catches problems early, like a date column stored as text or a stray currency symbol that would break math.
Step 3: Clean the data, then summarize
Tell it to fix what it found, then compute what you need. Be specific about the column names so there is no ambiguity. ChatGPT writes and runs the Python for you, but it helps to know roughly what it is doing.
import pandas as pd
df = pd.read_csv("sales.csv")
df["revenue"] = (df["revenue"]
.str.replace(r"[$,]", "", regex=True)
.astype(float))
df["date"] = pd.to_datetime(df["date"])
by_region = (df.groupby("region")["revenue"]
.sum()
.sort_values(ascending=False))
print(by_region)Step 4: Ask follow-up questions and request a chart
Once the data is clean you can keep asking questions in the same chat and the analysis builds on the cleaned table. Ask for a chart and ChatGPT renders it; you can download the image. You can also ask it to save the cleaned data and give you a download link.
Result
You went from a messy CSV to a cleaned table, a ranked summary by region, and a downloadable chart, all in one conversation, without opening a spreadsheet app or writing code yourself.
Watch related tutorials
1:42:18
28:14
41:09
9:47
8:23
52:31