ChatGPT Code Interpreter, Now Data Analysis: How to Use It
Related guide: Codex pricing: which ChatGPT plans include Codex
The ChatGPT Code Interpreter lets ChatGPT write code and run it, right in the chat, on files you upload. ChatGPT has since dropped the name: the feature was renamed Advanced Data Analysis and is now simply data analysis, built into ChatGPT. The OpenAI API still uses the old name for its sandbox tool. Because it runs code in a sandbox, it can check its own answers instead of only suggesting code.
How to use Code Interpreter in ChatGPT
Attach a file to the chat, ask your question in plain language, and check the code and tables it shows (OpenAI Academy). File size limits are in the OpenAI file uploads FAQ. For results that matter, verify the numbers yourself.
From conversation to execution
Without it, ChatGPT writes code. With it, ChatGPT runs the code and shows output. For data work, ChatGPT writes Python and runs it in a stateful Jupyter notebook, works with the files you upload, and keeps variables between steps of the conversation.
Instead of handing you a snippet to copy into your own environment, the model runs its code, checks the result and fixes its own errors. Since January 2026 the same sandbox also runs Bash and Node.js and can install packages, covered below.
What changes when the model can run code:
- Data: upload a CSV, a JSON file or an image and ask for analysis, charts or cleanup.
- Code execution: the model writes and runs code in an isolated sandbox, mostly Python, instead of only generating it.
- Files: it creates new files for you to download, such as a PDF report, a ZIP archive of images or a PNG chart.
ChatGPT with and without code execution
| Task | ChatGPT answering in text | ChatGPT running code (data analysis) |
|---|---|---|
| Code | Writes snippets for you to run | Writes code and runs it in the chat |
| Uploaded files | Reads documents and summarizes them | Opens CSVs, spreadsheets and images with code |
| Numbers | Estimates | Computes them, and shows the code it used |
| Charts | Writes the plotting code | Draws the chart in the chat |
| Downloads | None | Creates files such as CSV, PNG or ZIP |
What developers use it for
Three uses come up most: analyzing data, converting files, and testing code before you use it. You can go from a messy CSV to a clean bar chart in a couple of prompts.
Data analysis and visualization
Upload a dataset and ask for the operations you would otherwise run locally with pandas or Matplotlib. It is useful for quick prototyping: find error patterns in an export of server logs, or summarize engagement metrics from a CSV, without writing the script yourself. The model writes the code, runs it and shows the chart in the chat.
File manipulation and conversion
It also handles file chores you would otherwise script by hand. For instance, you could tell it to:
- Convert a folder of JPEGs to PNGs and resize them.
- Merge a dozen CSV files into one sheet.
- Create a ZIP archive containing only specific files from an upload.
Debugging and algorithm prototyping
Paste in problem code and ask it to find and fix the bug. Because it can run the code, it can test its own fix before handing it back. It also works as a scratchpad for trying an algorithm or a data structure before it goes into your codebase. It can explain or review a function you paste too, though it sees only what you paste, not the rest of the repository; our code review good practices list what a review should check. For agents that work on a whole repository, see our guide to the best AI coding tools for teams.
How to use ChatGPT for coding
Describe what you want or paste the code, name the language and the constraints, and pick the part of ChatGPT that matches where the code has to run:
| You want to | Use | What happens |
|---|---|---|
| Write, explain or review a snippet | ChatGPT chat | It answers in text. You run the code yourself. |
| Run code on a file, test a regex, make a chart | Data analysis | It writes the code, runs it in a sandbox and shows the result. |
| Change a repository and run its tests | Codex | The agent inspects files, makes edits and runs your tools. |
Two examples to try
These two cover common chores: a messy dataset and a regular expression that has to be right.

Cleaning a messy dataset
Upload the CSV, then give it a prompt like this:
"This CSV has user survey data, but it’s a mess. Can you please do the following:
- Find and remove all duplicate rows.
- Tell me which columns are missing more than 30% of their values.
- In the ‘Age’ column, make sure everything is an integer. If a value is blank or not a number, replace it with the median age of that column.
- Standardize the ‘Country’ column. For example, ‘U.S.A’ and ‘United States’ should both become ‘USA’.
- When you’re done, give me a quick summary of the changes you made and a link to download the cleaned CSV."
ChatGPT writes and runs the pandas code, reports what it changed and links the cleaned file. Read the summary: every judgment call, such as what counts as a duplicate, was made either the way you specified or the way the model guessed.
Generating and testing a regular expression
Regular expressions are easy to get almost right. Describe the pattern in plain English and have it build and test one.
For example:
"I need a Python script that creates and tests a regex pattern for a username. The rules are:
- It must be between 8 and 20 characters long.
- It has to start with a letter.
- It can only contain letters, numbers, and underscores.
- It cannot end with an underscore.
Please include a test suite with at least 5 valid and 5 invalid usernames to prove the regex works. Show me the test results."
It writes the regex and the tests, runs them and shows what passed and failed, so you see the pattern work before it goes into your application.
How it works
Three parts: the model, a sandbox that runs code, and preinstalled libraries.
The model is whichever one your ChatGPT plan runs. As of October 2026 that is GPT-5.6: GPT-5.6 Luna by default on Free and Go, and GPT-5.6 Sol on paid plans (OpenAI). GPT-4o, which older guides credit with Code Interpreter’s rise, was retired from ChatGPT in February 2026 (OpenAI).
The sandbox
Code doesn’t run on your computer. It runs in a temporary, isolated container on OpenAI’s side.
The container can’t make outbound network requests, so code can’t call an API or scrape a site. Two exceptions arrived in January 2026: pip install and npm install work through an OpenAI proxy, and a separate container.download tool can fetch a file from a URL into the container (Simon Willison, January 26, 2026).
The isolation comes with limits:
- CPU and memory: a very large dataset or a long calculation can hit the cap and time out.
- Session lifetime: the environment is temporary. When it expires, it is reset along with the files you uploaded.
Libraries and languages
The sandbox comes with the common Python data stack: pandas for tables, Matplotlib for charts and Pillow for images, among others.
It is no longer Python only. Simon Willison’s tests on January 26, 2026 found it runs Bash commands and Node.js directly, ran hello-world programs in Ruby, Perl, PHP, Go, Java, Swift, Kotlin, C and C++, and installed extra packages with pip and npm. OpenAI’s help page still describes data analysis as Python in a Jupyter notebook, and the change had no release note when Willison wrote it up, so treat the extra languages as working but not formally documented.
Code it writes still needs a normal review before it goes near production.
Code Interpreter in the OpenAI API
Developers get the same idea through the API’s tool of the same name, code_interpreter: the model writes and runs Python in a sandboxed container. A container that goes unused for 20 minutes expires and its data is discarded, so download what you need while it is active.
Writing prompts that get better results
Treat it like a new team member: give the context, the goal and the output you want, not just a file and “figure this out.”

Provide clear context and sample data
Tell the model what the data is, where it came from and what you’re trying to achieve. If you can, paste a few sample rows into the prompt.
Instead of “clean this file,” try:
“I’m working with a CSV of user sign-up data from our latest marketing campaign, and I need to prep it for a presentation. The ‘signup_date’ column is a mess with different formats, and the ‘country’ column has some typos. Here are the first three rows to give you an idea:
...”
That background tells the model why you want the change, so it makes better choices on the edge cases.
Use iterative refinement
Don’t try to write one perfect prompt for a complex task. Start broad, look at the result, and steer with follow-ups: “That’s a good start, but switch to a bar graph with a different color for each category.”
A typical sequence:
- Initial prompt: “Analyze this sales data and tell me which products are selling the best.”
- Refinement: “Great. Can you visualize that as a horizontal bar chart? And please add the exact sales number to the end of each bar.”
- Final polish: “Perfect. Now, export that chart for me as a high-resolution PNG file. I’ll also need the cleaned-up data in a new CSV.”
Define your output format
Say exactly what you want to download:
- A script? Ask for a .py file.
- A chart? Ask for .png, or .svg for a vector.
- The data itself? Ask for .json or .csv.
Frequently asked questions
Is it safe to upload my code or data?
The code runs in an isolated container that can’t reach your machine or make general network requests. Your uploaded files are still sent to OpenAI and kept under your plan’s data rules, so check your workspace’s policy (see OpenAI’s file uploads FAQ) before you upload customer data or proprietary code. When a session expires, the environment resets and you upload the files again.
What are the main limitations?
Each session has a fixed amount of CPU and memory, so a huge dataset or a long-running job can time out. The container can’t call APIs or scrape websites; it can only install pip and npm packages through OpenAI’s proxy and download a file from a URL. Sessions are temporary, and an expired one loses its uploaded files and state.
Can it work with languages other than Python?
Yes, since January 2026. Simon Willison found that the sandbox runs Bash and Node.js directly and can run code in Ruby, Perl, PHP, Go, Java, Swift, Kotlin, C and C++. Python is still what data analysis uses for files and charts, and the model can write and explain code in any language either way.
What should I use for work on a codebase?
Use Codex, OpenAI’s coding agent, which runs in a terminal, an IDE extension, the ChatGPT desktop app and the cloud. ChatGPT Plus ($20 a month) includes it, and a Business seat is $25 a month, or $20 billed annually (OpenAI, October 2026). If your team works in Codex or Claude Code, Zest shows each engineer’s sessions, models and tokens next to the pull requests they led to; it captures coding-agent sessions, not ChatGPT chats.
Zest is AI coding analytics for engineering teams: it shows which coding agents, models and skills each engineer uses, what they cost, and which sessions end in merged pull requests. See how Zest works.