How to Do Data Analysis in Excel with ChatGPT

Cody Schneider

You can now use ChatGPT as a powerful data analyst right inside Excel. Instead of manually wrestling with pivot tables, VLOOKUPs, and complex formulas, you can simply upload your spreadsheet and ask questions in plain English. This article provides a step-by-step guide on how to use ChatGPT with your Excel files to clean data, perform analysis, create charts, and find insights instantly.

What is ChatGPT's Advanced Data Analysis (Formerly Code Interpreter)?

Advanced Data Analysis is a feature available to ChatGPT Plus subscribers that transforms the chatbot into a skilled assistant for working with data. It allows you to upload files directly into your chat, including common formats like .xlsx (Excel) and .csv (Comma-Separated Values). Once a file is uploaded, you can instruct ChatGPT to analyze it.

The best part? You don't need to know how to code. Behind the scenes, ChatGPT is writing and running Python scripts to follow your instructions, but you never have to see or write a single line of it. You just provide prompts in plain English, and it handles the technical work.

With Advanced Data Analysis, you can ask ChatGPT to:

  • Clean and prepare a dataset: It can find and fill in missing values, remove duplicates, or reformat columns.

  • Perform statistical analysis: You can ask it to calculate totals, averages, correlations, or identify trends.

  • Create data visualizations: It can instantly generate charts and graphs like bar charts, line graphs, and pie charts based on your data.

  • Summarize key findings: It can scan the entire dataset and give you a high-level summary of what it contains and what insights stand out.

Step 1: Preparing Your Excel Data for Analysis

Just like with any data analysis project, the quality of your output depends on the quality of your input. Before uploading your file to ChatGPT, taking a few minutes to clean up your spreadsheet will lead to much better results. This principle is often called "Garbage In, Garbage Out," and it absolutely applies here.

Use Clear, Descriptive Headers

Your column headers are the first thing ChatGPT will look at to understand your data. Make them simple, unique, and easy to understand. For instance, use "Revenue" instead of "REV_Q1_Final" or "Sale_Date" instead of just "Date_1." This simple step helps the AI correctly identify what each column represents without needing clarification.

Standardize Your Data Formats

Inconsistent formatting is a common source of errors. Go through your spreadsheet and make sure your data is standardized:

  • Dates: Pick one format and stick to it (e.g., YYYY-MM-DD or MM/DD/YYYY). Don't mix formats in the same column.

  • Numbers: Ensure columns intended for calculation contain only numbers. Remove text like "N/A" or currency symbols ($) where they might interfere with analysis.

  • Text: Standardize casing if necessary. For example, in a "Country" column, make sure "USA," "U.S.A.," and "United States" are all consolidated into one consistent value.

Address Blank Cells and Missing Data

Decide how you want to handle empty cells. You have a few options: you can either delete the entire row if a critical piece of information is missing, or fill the blank cell with a placeholder like "Unknown" or a zero. Alternatively, you can ask ChatGPT to handle this for you. A good prompt is: "Scan this file for missing data in the 'Revenue' column and fill any blank cells with the average value for that column."

Export to a CSV File for Simplicity

While ChatGPT can handle .xlsx files, the .csv (Comma-Separated Values) format is often more reliable and easier for systems to process. It's a plain-text format that sheds complex Excel features like formulas and macros, which can sometimes confuse data analysis tools. Exporting is easy: in Excel, just go to File > Save As and choose "CSV UTF-8" from the file format dropdown.

Step 2: Performing Data Analysis with ChatGPT - A Step-by-Step Guide

Once your data is prepped, you're ready to start the analysis. The process is straightforward and conversational.

1. Start a New Chat in GPT-4 Mode

Log in to your ChatGPT Plus account. At the top of the chat interface, make sure you have GPT-4 selected. Advanced Data Analysis is a built-in function of GPT-4, so you don't need to enable anything in your settings anymore.

2. Upload Your File

In the message box at the bottom, you'll see a small paperclip icon on the left. Click it, select your prepared .csv or .xlsx file, and upload it. You'll see the file appear above the message box, confirming it's attached and ready for analysis.

3. Give ChatGPT Its First Prompt (The "What Is This?" Prompt)

Before diving into specific questions, it's a great practice to have ChatGPT first confirm its understanding of your data. This sanity check ensures you're both on the same page. A great starting prompt is:

"Here is my sales data for the last quarter. Can you analyze this file and give me a brief summary of the data? Please include the column names, the number of rows, and identify any potential issues like missing values or unusual data types."

ChatGPT will read the file and provide a summary, giving you confidence that it correctly interpreted your column headers and data structure.

4. Ask Specific Questions for Analysis

Now for the fun part. Think of questions you want to answer about your data and just ask them. It helps to start with broad questions and then get more specific. Let's imagine we're using an e-commerce sales dataset with columns like Date, Product, Category, Sales, and Region.

Here are some examples of prompts, moving from simple to more complex:

Simple Data Retrieval:

  • "What was the total revenue in this dataset?"

  • "How many unique products were sold?"

  • "Which product generated the most revenue?"

Segmented Analysis:

  • "Show me the total sales broken down by region."

  • "What is the average transaction value for each product category?"

  • "Which month had the highest sales?"

Creating Summary Tables (like a Pivot Table):

  • "Create a summary table that shows the total sales for each product category, broken down by region."

  • "Identify the top 5 products by total sales and show their revenue and the total number of units sold."

The key is to ask a question and review the answer. If it's not quite what you wanted, refine your question and ask again. It's an iterative, conversational process.

Step 3: Creating Charts and Visualizations

A picture is worth a thousand words, and with data, a chart is worth a thousand rows in a spreadsheet. Creating visualizations in ChatGPT is as easy as asking for them. It will generate the chart as an image file that you can download directly from the chat.

Here are some example prompts for generating different types of visualizations using our fictional e-commerce dataset:

  • Bar Chart: "Create a bar chart showing the total sales for each product category. Make the bars horizontal and sort them from highest to lowest."

  • Line Chart: "Generate a line chart that illustrates the total sales trend over time, showing the daily revenue for the entire period."

  • Pie Chart: "Show me a pie chart illustrating the revenue distribution by region."

  • Scatter Plot: "Can you make a scatter plot to show the relationship between product price and units sold?"

Feel free to customize them. You can ask ChatGPT to change colors, add labels, or adjust the chart title until it's just right.

Tips for Getting the Best Results

To make your analysis sessions even more effective, keep these best practices in mind.

Be Clear and Unambiguous

The more specific your prompt, the better your analysis is likely to be. Avoid vague requests like "show me what's working." Instead, ask something precise like, "Which are the top 3 marketing channels by conversion rate for last month?" A good prompt clearly defines what you want to measure, the metric to use, and the timeframe.

Iterate and Refine Your Questions

Don't expect the first prompt to provide the ultimate insight. Data analysis is about exploration. Use ChatGPT's responses as a starting point for deeper questions. For example:

  1. You ask: "What was our highest-selling product last month?"

  2. ChatGPT answers: "The 'Pro-Gamer Mouse' was the highest-seller."

  3. Your follow-up question: "Interesting. Can you now break down the sales of the 'Pro-Gamer Mouse' by country?"

Always Double-Check the Output

While extremely powerful, the technology is not infallible. Think of ChatGPT as a very capable junior analyst—fast and helpful, but still requires oversight. Always perform a quick sanity check on its conclusions. If it tells you your revenue doubled last week, cross-reference that with your original Excel file or your gut feeling. For critical business reports, spot-check a few of its calculations to ensure accuracy before sharing the results.

Ask to See the Code

If you're curious about how ChatGPT arrived at an answer or want to validate its method, simply ask: "Show me the Python code you used for that last analysis." Reviewing the code provides full transparency and can help you catch any misunderstandings in the analysis.

Final Thoughts

Using ChatGPT for Excel data analysis transforms a once-tedious process into an intuitive, interactive conversation. This capability empowers anyone to move beyond basic spreadsheet functions and start uncovering meaningful insights, all without needing to master complex formulas or learn a new software tool.

While using ChatGPT for one-off analyses is incredibly powerful, it can become repetitive if you're pulling the same reports every week, as you have to re-upload files and rewrite prompts each time. We built Graphed to streamline this workflow by connecting directly to your live data sources, whether that's Google Analytics, Shopify, a CRM, or even a Google Sheet that updates automatically. Our platform automates the reporting process, allowing you to build real-time, interactive dashboards with simple, natural language so your insights are always current and ready when you need them.