Analyze Sales Data with Claude

Turn a raw sales CSV into charts and a report using Claude.

Introduction

30 Second Summary

Data is everywhere in business, but making sense of raw numbers usually requires coding skills or expensive software. What if you could turn a spreadsheet into professional charts and business insights just by asking questions in plain English?

In this project, you will use Claude's built-in code execution feature to analyze a sales dataset and produce professional visualizations and a downloadable report. No coding experience required.

What You'll Build

You'll perform a complete data analysis workflow entirely through conversation with Claude, turning a raw CSV file into actionable business intelligence.

By the end of this project, you'll have:

  • Multiple data visualizations (bar charts, trend lines, pie charts) as downloadable PNG images.
  • A professional PDF report with insights and actionable business recommendations.
  • Confidence using prompt engineering techniques to get high-quality analysis from Claude.
  • Secret Mission: Build an interactive sales dashboard artifact that lets you filter data by region and product category.

Are there any prerequisites?

None. This project includes setup for all required tools. You just need a free Claude account, which you'll create in Step 1.

Set Up Claude and Prepare Your Data

Before you can ask Claude to analyze data, you need two things: access to Claude's code execution feature and a dataset to work with.

In this step, you will create a free Claude account and prepare a sample sales dataset as a CSV file. This file is what you will upload to Claude for analysis in the next step.

In this step, get ready to:
  • Sign in to Claude and confirm code execution is enabled.
  • Create a sample sales dataset CSV file on your computer.
Create a free Claude account and verify code execution

Claude's code execution feature lets Claude run Python code behind the scenes to analyze data, create charts, and generate files. You interact entirely through natural language. No coding required.

  • Open your browser and go to claude.ai.
  • Sign up for a free account using your email address, or sign in if you already have one.

What is Claude?

Claude is an AI assistant built by Anthropic. Its code execution feature can run Python scripts, process data files, and generate downloadable outputs like charts and reports. All of this happens through conversation. You type what you want in plain English, and Claude writes and runs the code for you.

Now confirm that code execution is enabled on your account. It is turned on by default for free accounts, but it is worth double-checking.

  • Click your initials in the lower left corner of the Claude interface.
  • Select Settings from the menu.
  • Click Capabilities in the left sidebar.
  • Confirm that the Code execution and file creation toggle is switched on.

✔️ The toggle is already on

You are all set. Code execution is enabled by default on free accounts, so this is the expected state.

ⓧ The toggle is off

  • Click the Code execution and file creation toggle to switch it on.

The toggle should turn blue to indicate it is active.

Don't see the Capabilities page?

If you are on a Team or Enterprise plan, your organization admin may have disabled this setting. Ask your admin to enable code execution, or try using a personal free account instead.

Help me find the code execution setting in Claude.

Create your sample sales dataset

You need a CSV file with sales data that Claude can analyze. CSV stands for Comma-Separated Values. It is a simple text format that stores tabular data, and it is the standard format for sharing datasets.

  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type TextEdit (macOS) or Notepad (Windows) and press Enter to open it.
  • Copy and paste the entire dataset below into your text editor:
Date,Product,Region,Units Sold,Unit Price,Total Revenue
2024-01-15,Laptop,North,12,999.99,11999.88
2024-01-22,Headphones,South,45,79.99,3599.55
2024-01-28,Keyboard,East,30,149.99,4499.70
2024-02-03,Monitor,West,8,399.99,3199.92
2024-02-10,Mouse,North,60,49.99,2999.40
2024-02-18,Laptop,South,15,999.99,14999.85
2024-02-25,Headphones,East,38,79.99,3039.62
2024-03-04,Keyboard,West,25,149.99,3749.75
2024-03-11,Monitor,North,10,399.99,3999.90
2024-03-19,Mouse,South,55,49.99,2749.45
2024-03-26,Laptop,East,18,999.99,17999.82
2024-04-02,Headphones,West,42,79.99,3359.58
2024-04-09,Keyboard,North,35,149.99,5249.65
2024-04-16,Monitor,South,12,399.99,4799.88
2024-04-23,Mouse,East,48,49.99,2399.52
2024-05-01,Laptop,West,20,999.99,19999.80
2024-05-08,Headphones,North,50,79.99,3999.50
2024-05-15,Keyboard,South,28,149.99,4199.72
2024-05-22,Monitor,East,14,399.99,5599.86
2024-05-30,Mouse,West,65,49.99,3249.35
2024-06-05,Laptop,North,22,999.99,21999.78
2024-06-12,Headphones,South,55,79.99,4399.45
2024-06-19,Keyboard,East,32,149.99,4799.68
2024-06-26,Monitor,West,16,399.99,6399.84

What is in this dataset?

This dataset contains 24 sales transactions from January to June 2024. Each row records the date of a sale, the product type (Laptop, Headphones, Keyboard, Monitor, or Mouse), the region (North, South, East, or West), units sold, price per unit, and total revenue.

The mix of products, regions, and time periods gives Claude enough variety to find meaningful trends and comparisons.

  • Save the file to your Desktop with the name sales_data.csv.

Saving as CSV on macOS

In TextEdit, click Format in the menu bar, then select Make Plain Text before saving. This ensures the file saves as plain text rather than rich text. When saving, type sales_data.csv as the filename and choose your Desktop as the location.

  • Confirm the file exists by checking your Desktop for a file named sales_data.csv.

File saved as .csv.txt or .rtf?

On Windows, Notepad may append .txt to your filename. When saving, change the Save as type dropdown to All Files and type the full name sales_data.csv including the extension.

On macOS, if TextEdit saved as .rtf, you forgot to switch to plain text first. Delete the file, reopen TextEdit, click Format > Make Plain Text, paste the data again, and save.

Help me save my file as a proper CSV.

✔️ Awesome, I've got everything!

Great. Make sure you can see sales_data.csv on your Desktop before continuing.

ⓧ I'd like to double check the full code

Your sales_data.csv file should contain exactly this content:

Date,Product,Region,Units Sold,Unit Price,Total Revenue
2024-01-15,Laptop,North,12,999.99,11999.88
2024-01-22,Headphones,South,45,79.99,3599.55
2024-01-28,Keyboard,East,30,149.99,4499.70
2024-02-03,Monitor,West,8,399.99,3199.92
2024-02-10,Mouse,North,60,49.99,2999.40
2024-02-18,Laptop,South,15,999.99,14999.85
2024-02-25,Headphones,East,38,79.99,3039.62
2024-03-04,Keyboard,West,25,149.99,3749.75
2024-03-11,Monitor,North,10,399.99,3999.90
2024-03-19,Mouse,South,55,49.99,2749.45
2024-03-26,Laptop,East,18,999.99,17999.82
2024-04-02,Headphones,West,42,79.99,3359.58
2024-04-09,Keyboard,North,35,149.99,5249.65
2024-04-16,Monitor,South,12,399.99,4799.88
2024-04-23,Mouse,East,48,49.99,2399.52
2024-05-01,Laptop,West,20,999.99,19999.80
2024-05-08,Headphones,North,50,79.99,3999.50
2024-05-15,Keyboard,South,28,149.99,4199.72
2024-05-22,Monitor,East,14,399.99,5599.86
2024-05-30,Mouse,West,65,49.99,3249.35
2024-06-05,Laptop,North,22,999.99,21999.78
2024-06-12,Headphones,South,55,79.99,4399.45
2024-06-19,Keyboard,East,32,149.99,4799.68
2024-06-26,Monitor,West,16,399.99,6399.84

Your data is ready and Claude is set up. Next, you will upload this file to Claude and start exploring what the data reveals.

Upload Data and Explore with Claude

Your dataset is ready and your environment is set up. Now it's time to put Claude to work as your personal data analyst.

In this step, you'll upload your sales data and use prompt engineering techniques to get Claude to perform a thorough initial exploration. A well-structured prompt is the difference between a vague summary and genuinely useful analysis.

In this step, get ready to:
  • Upload your CSV file to a Claude conversation.
  • Prompt Claude to explore your dataset and surface key statistics.
  • Ask a follow-up question to dig deeper into regional revenue performance.
Upload your CSV and request an initial analysis

Claude's code execution feature lets it run Python behind the scenes to process your data. You just need to upload the file and tell Claude what you want to know.

  • In your Claude conversation, click the + button in the lower left corner of the chat box.
  • Select Add files or photos.
  • Navigate to where you saved sales_data.csv and select it.

You should see the file name appear as an attachment in the chat box. Now you'll write a prompt that tells Claude exactly what analysis you want.

  • Type (or copy-paste) the following prompt into the chat box and press Enter to send it:
I'm uploading a sales dataset (CSV file). Please analyze it by:

1. Summarizing the dataset structure (columns, data types, number of rows)
2. Identifying any data quality issues (missing values, duplicates, inconsistencies)
3. Providing basic statistics (total revenue, average units sold, date range covered)

Please run the analysis using code and show me the results.

Why structure the prompt this way?

This prompt uses two key techniques from Anthropic's official prompting guide. First, it provides context ("I'm uploading a sales dataset") so Claude understands what the file contains.

Second, it breaks the complex task into numbered steps. This gives Claude a clear structure to follow and makes the output easier for you to read. Vague prompts like "analyze this file" produce vague results.

After a few seconds, Claude will execute Python code and return a structured summary of your dataset. You should see a breakdown of each column, any data quality notes, and a statistics section with totals and averages.

Not seeing code execution output?

If Claude responds with only text (no code execution), it may not have recognized the file. Make sure the file appears as an attachment before you send the message.

If the file is attached but Claude still doesn't run code, try adding "Use Python to analyze the CSV" to the end of your prompt. On Enterprise or Team plans, an admin may have disabled code execution for your organization.

Help me troubleshoot why Claude isn't running code on my uploaded CSV file.

Ask a follow-up question to dig deeper

Claude's initial summary gives you the big picture. The real power of conversational analysis is that you can ask follow-up questions that build on what Claude already knows about your data.

  • Review Claude's response. Look for anything surprising in the statistics or data quality section.
  • In the same conversation, type (or copy-paste) this follow-up prompt and press Enter:
Which region has the highest average revenue per sale? Break this down by region and include the number of transactions for each.

What makes this a good follow-up?

This follow-up is specific about what metric to calculate (average revenue per sale), how to group it (by region), and what extra context to include (number of transactions). Being specific about your desired output is one of the most effective prompting techniques.

Because you're in the same conversation, Claude already has your dataset loaded. It doesn't need to re-read the file. This is prompt chaining in action.

Claude will run another round of code and return a regional breakdown. You should see each region listed with its average revenue per sale and transaction count.

Getting a different breakdown than expected?

Claude's exact numbers depend on the data in your CSV. As long as you see a clear region-by-region comparison with averages, you're on track.

If Claude responds without running code (just estimating from the earlier output), add "Please calculate this using code" to your prompt. This nudges Claude to run a fresh computation rather than approximating.

Help me get Claude to run a proper regional analysis on my sales data.

You've now completed your first round of exploratory data analysis using nothing but natural language prompts. Next up, you'll turn these raw findings into professional visualizations that tell a clear story.

Generate Visualizations and Insights

You've explored the raw numbers and uncovered patterns in your sales data. Now it's time to turn those numbers into something visual.

Charts communicate findings faster than tables ever could. In this step, you'll prompt Claude to generate professional visualizations and distill the data into actionable business insights.

In this step, get ready to:
  • Generate a bar chart and a line chart showing revenue and sales trends.
  • Create a pie chart and extract the top 3 business insights.
  • Download all visualization files to your computer.
Prompt Claude to create a bar chart and line chart

The more specific your prompt, the better your output. Instead of asking for "a chart," you'll tell Claude exactly what chart type, style, colors, and labels you want.

What is prompt engineering?

Prompt engineering is the practice of crafting specific, detailed instructions to get high-quality output from an AI. Being specific about your desired output is one of the most reliable ways to steer Claude's responses.

In this step, you'll apply two key techniques: specifying output constraints (chart type, colors, labels) and breaking complex tasks into steps (one chart at a time).

  • In the same Claude conversation from the previous step, type the following prompt into the chat box:
Using the sales data I uploaded, please create two visualizations:

1. A bar chart showing total revenue by product category:
   - Use a clean, professional style with a white background
   - Use distinct colors for each product category (blues and greens preferred)
   - Add clear axis labels: "Product Category" on x-axis, "Total Revenue ($)" on y-axis
   - Include a descriptive title: "Total Revenue by Product Category"
   - Add value labels on top of each bar
   - Save as a PNG file named "revenue_by_product_bar_chart.png"

2. A line chart showing monthly sales trends:
   - X-axis: months (formatted as Month Year)
   - Y-axis: total revenue per month
   - Use a bold line with data point markers
   - Include a grid for readability
   - Title: "Monthly Sales Trend"
   - Save as a PNG file named "monthly_sales_trend_line_chart.png"

Please generate both charts and make them available for download.
  • Press Enter to send the prompt.

What does this prompt do?

This prompt uses output constraints to tell Claude exactly how to format the visualizations. Each numbered section specifies the chart type, color palette, axis labels, title, and filename.

Behind the scenes, Claude writes and executes Python code using libraries like matplotlib to generate these charts. You get professional visualizations without writing a single line of code yourself.

Wait for Claude to finish executing. You should see both charts appear inline in the conversation, along with download links for each PNG file.

Don't see any charts?

If Claude responds with text only and no images, the code execution feature may be disabled. Navigate to Settings > Capabilities and confirm the Code execution and file creation toggle is on.

If you see an error about the code timing out, try sending the prompt again. Claude's computing environment occasionally needs a second attempt for larger tasks.

Help me troubleshoot why Claude isn't generating chart images from my sales data

Create a pie chart and summarize business insights

Your bar chart and line chart cover product performance and time trends. A pie chart adds the regional perspective, completing your visual analysis from three different angles.

  • Type this prompt into the Claude chat box to request the pie chart and a business insights summary:
Now please create one more visualization and a summary:

1. A pie chart showing regional performance (% of total revenue by region):
   - Use contrasting colors for each region
   - Include percentage labels on each slice
   - Add a legend outside the chart
   - Title: "Revenue Distribution by Region"
   - Save as "regional_performance_pie_chart.png"

2. Based on all the analysis so far, summarize the top 3 business insights from this data. For each insight:
   - State the finding clearly
   - Explain why it matters for the business
   - Suggest one actionable recommendation
  • Press Enter to send the prompt.

Why ask for insights alongside the chart?

Combining a visualization request with an analysis request in one prompt takes advantage of prompt chaining. Claude already has the full conversation context from your earlier exploration, so it can connect the dots across all findings to produce richer insights.

You should see the pie chart appear inline, followed by a numbered list of three business insights with findings, explanations, and recommendations.

Refine if the insights feel generic

If Claude's insights are too surface-level, try a follow-up prompt like: "Can you make insight #2 more specific? Include the exact revenue difference and percentage gap between the top and bottom regions." Specificity in your request leads to specificity in the output.

Download the generated PNG files

Claude has generated three chart images as downloadable files. You'll save them to your computer so you can include them in presentations or reports later.

  • Scroll up to the first response where Claude generated the bar chart and line chart.
  • Click the download icon on the revenue_by_product_bar_chart.png file to save it to your computer.
  • Click the download icon on the monthly_sales_trend_line_chart.png file to save it to your computer.
  • Scroll down to the pie chart response and click the download icon on regional_performance_pie_chart.png to save it.

Where do the files go?

Downloaded files go to your default Downloads folder. You can also save files directly to Google Drive by clicking the Google Drive option if your account is connected.

  • Open your Downloads folder and confirm you see all three PNG files: revenue_by_product_bar_chart.png, monthly_sales_trend_line_chart.png, and regional_performance_pie_chart.png.
  • Double-click any file to preview it. You should see a clean, professional chart with labels and colors matching what you specified in your prompts.

Can't find the download links?

Look for the file name displayed below or beside each chart image in Claude's response. The download icon appears when you hover over the file attachment. If you only see the chart embedded as an image with no file link, ask Claude: "Can you provide the charts as downloadable PNG files?"

Help me find and download my chart files from Claude

You now have three professional visualizations and a set of data-driven insights. Next up, you'll package everything into a polished PDF report ready to share with stakeholders.

Create a Professional Report

You now have charts, statistics, and business insights sitting inside your Claude conversation. The missing piece is packaging all of this into a single deliverable that you could hand to a manager or stakeholder.

In this step, you will ask Claude to compile everything into a professional PDF report. Then you will iterate on the report by refining a section with a follow-up prompt.

In this step, get ready to:
  • Generate a professional PDF report with an executive summary, key findings, and recommendations.
  • Iterate on the report by refining a specific section through a follow-up prompt.
Prompt Claude to generate a PDF report

A well-structured report needs clear sections so readers can quickly find what matters to them. Your prompt should specify both the content and the structure you want.

  • In the same Claude conversation, paste the following prompt to ask Claude to create a professional PDF report:
Please compile all the analysis we've done into a professional PDF report. Structure it with these sections:

1. Executive Summary (2-3 sentences summarizing the most important findings)
2. Dataset Overview (brief description of the data analyzed)
3. Key Findings (include the charts you generated - bar chart, line chart, and pie chart - embedded in this section with brief explanations of each)
4. Top 3 Business Insights (the insights you identified earlier, with supporting data)
5. Actionable Recommendations (3-5 specific recommendations based on the data)

Make the report look professional with clear headings, consistent formatting, and a clean layout. Title it "Sales Data Analysis Report".

What does this prompt do?

This prompt uses several effective techniques. It specifies the exact sections you want, gives Claude a clear structure to follow, and asks for embedded charts rather than just text descriptions.

By naming the charts Claude already generated, you are referencing files that exist in Claude's computing environment from earlier in the conversation. Claude can embed those directly into the PDF.

Specifying "professional" and "clean layout" guides Claude's formatting choices without requiring you to know any design tools.

Claude will run Python code to build the PDF. You should see a progress indicator while it works, followed by a downloadable file appearing in the response.

Don't see a downloadable PDF?

If Claude responds with text instead of generating a file, add a follow-up message like: "Please generate this as a downloadable PDF file, not just text." This explicitly tells Claude to use its file creation capability.

If you see an error about the computing environment timing out, try simplifying the request. Ask Claude to create the report without embedded charts first, then add charts in a follow-up.

Help me get Claude to generate a PDF report from my analysis

Download and iterate on the report

Your first draft is a starting point. Real reports go through rounds of revision. This is where conversational AI shines because you can refine specific sections without rewriting the entire document.

  • Click the download button on the PDF file that Claude generated to save it to your computer.
  • Open the PDF and read through it to identify one section you would like to improve.
  • Return to your Claude conversation and send a follow-up prompt to refine a specific section. Use one of these examples or write your own:
Make the executive summary punchier - lead with the single most impactful number and keep it to 2 sentences maximum. Then regenerate the full PDF with this change.

Why specify "regenerate the full PDF"?

Without this instruction, Claude might respond with just the edited text rather than producing a new downloadable file. Explicitly asking for the full PDF ensures you get an updated file you can download.

You could also try other refinements like "Add a comparison table showing revenue by region and product" or "Make the recommendations more specific with dollar figures." Each follow-up builds on the full conversation context.

  • Download the updated PDF once Claude generates it.
  • Compare the two versions to see how your iteration improved the report.

You should now have a polished PDF saved locally with a clear executive summary, embedded charts, and actionable recommendations.

Save to Google Drive

Instead of downloading, you can save generated files directly to Google Drive by clicking the Google Drive option next to the download button. This is useful if you want to share the report with colleagues immediately.

Updated PDF looks the same as before?

Double-check that you downloaded the newest file, not the original. Claude generates a new file each time, so look for the most recent download link in the conversation.

If Claude only returned text changes without a new PDF, send a follow-up: "Please regenerate the complete PDF with that change included."

Help me iterate on my Claude-generated PDF report

You have just turned raw CSV data into a professional, presentation-ready report through nothing but conversation. Next up, take on the Secret Mission and build an interactive dashboard that brings this data to life.

Secret mission

Build an Interactive Sales Dashboard

You've created static charts and a PDF report. But what if you could hand someone a live, filterable dashboard instead? In this secret mission, you'll ask Claude to build an interactive React artifact that lets anyone explore your sales data by region and product category.

Clean Up Your Resources

Clean Up Your Resources

This project runs entirely on Claude's free tier with no cloud infrastructure, so there are no ongoing costs. Decide whether to keep your conversation and files, or clean them up.

Resources you used:

  • Claude conversation (with uploaded sales_data.csv and all analysis history).
  • Published interactive sales dashboard artifact (shareable link).
  • Downloaded local files (sales_data.csv, PNG charts, sales_analysis_report.pdf).

Keep everything running

No action needed. Choose this if you want to revisit the conversation, refine your analysis, or reuse prompts later.

  • Your Claude conversation stays in your chat history indefinitely.
  • Your published dashboard artifact remains accessible via its shareable link.
  • Your downloaded files remain in your local Downloads folder.

Pause - I'll come back to this later

No running processes to stop. Your conversation and files persist without using any resources. If you want to tidy up your Claude sidebar without losing work:

  • Leave the conversation in your chat history. You can find it later by searching in the left sidebar.
  • Move your downloaded files into a dedicated folder on your computer so they are easy to find when you return.

Delete - I don't want to use this again

Remove all project resources and start fresh.

  • Unpublish your dashboard artifact: open the artifact in Claude, then click the Unpublish button. This revokes access for anyone with the link. Note that you cannot republish the same artifact after unpublishing.
  • Delete your Claude conversation: click the conversation name at the top of the screen, then select Delete from the options that appear.
  • Delete your local files. On macOS, open Terminal and run the command below. On Windows, open File Explorer and delete the files from your Downloads folder.
rm ~/Downloads/sales_data.csv ~/Downloads/revenue_by_product_bar_chart.png ~/Downloads/monthly_sales_trend_line_chart.png ~/Downloads/regional_performance_pie_chart.png ~/Downloads/sales_analysis_report.pdf

What about my Claude account?

Your free Claude account has no ongoing cost. You can keep it for future projects or delete it by visiting the account management section in Claude's Help Center.

Nice Work!

Nice Work!

You just turned raw sales data into professional business intelligence, all by having a conversation with an AI.

Starting from a simple CSV file, you guided Claude through a full analysis workflow and walked away with charts, a report, and an interactive dashboard.

What you learned:

  • Performed a complete data analysis workflow (exploration, visualization, reporting) using Claude's code execution feature.
  • Generated professional data visualizations (bar charts, line charts, pie charts) through natural language prompts.
  • Created a downloadable PDF report with an executive summary, key findings, and actionable recommendations.
  • Built an interactive, filterable sales dashboard as a shareable artifact.

Ready to quiz yourself?