Claude Code

How to Use Claude Code for Data Analysis — Practical Guide

minhaskills.io How to Use Claude Code for Data Analysis — Practical Guide Claude Code
minhakills.io 2 Apr 2026 13 min read

You have data. Sales CSVs, Google Analytics exports, inventory spreadsheets, ERP reports. But turning all of this into actionable insights is the part that gets stuck. Complex formulas in Excel, R language that no one understands, BI dashboards that cost thousands per month.

Claude Code solves this in a simple way: you point to a data file, ask what you want to know in Portuguese, and it analyzes, processes and responds. No formulas, no programming, no expensive tools.

In this guide, you'll see real-world examples of data analysis with Claude Code -- from simple CSVs to SQL queries, from GA4 metrics to interactive dashboards.

1. Why Claude Code for Data

Claude Code has a critical advantage over common chatbots for data analysis: itaccess your files directly e execute code in your terminal. This means that:

Practical advantage:With the context of 1M tokens, Claude Code can keep in memory the analysis of several files simultaneously. You can cross-reference sales data with marketing data with inventory data in a single session.

2. Parsing CSV files

CSV is the most common format for exchanging data. Claude Code reads and analyzes any CSV, regardless of size or format.

Step 1: initial exploration

Claude Code
> leia o arquivo dados/vendas-2025.csv e me de uma visao
geral: quantas linhas, quais colunas, tipos de dados,
valores nulos, e as primeiras 5 linhas como exemplo.

Claude Code runs a script with pandas and returns:

Step 2: specific questions

Now that you know the structure, ask what you need:

Claude Code
> do arquivo de vendas, me responda:
1. Faturamento total e por trimestre
2. Top 10 produtos por receita
3. Regiao com maior crescimento Q4 vs Q3
4. Dia da semana com mais vendas
5. Ha alguma anomalia nos dados?

Claude Code generates and executes the analysis script, presenting each answer with concrete data. If it detects anomalies (such as a day with revenue 10x above average), it automatically alerts and investigates.

3. Example: complete sales analysis

Let's look at an end-to-end example. You have a sales CSV and want a complete report:

Claude Code
> analise vendas-2025.csv e crie um relatorio completo com:
- resumo executivo (faturamento, ticket medio, total pedidos)
- analise mensal com tendencia
- top 10 produtos e categorias
- analise por regiao
- cohort de clientes (novos vs recorrentes)
- salve o script como analise_vendas.py to eu reutilizar

Claude Code generates a complete script:

This script is reusable. Every month, update the CSV and runpython analise_vendas.pyto have the report updated.

4. Analyzing GA4 data

Google Analytics 4 allows you to export data in CSV or connect via BigQuery. Claude Code analyzes both formats.

CSV export from GA4

Claude Code
> leia o export do GA4 (ga4-export-marco-2026.csv) e analise:
- paginas mais visitadas
- taxa de bounce por pagina
- fontes de trafego que mais convertem
- funil: visita > adicionar carrinho > compra
- sugestoes de otimizacao baseadas nos dados

Claude Code reads the export, identifies the relevant metrics (sessions, engaged_sessions, conversions, bounce_rate) and generates actionable insights. It can compare with previous periods if you provide both files.

Crossing GA4 with sales data

Claude Code
> cruze os dados do GA4 (ga4-export.csv) com as vendas
(vendas-2025.csv) por data. Quero ver: correlacao entre
trafego e vendas, quais fontes de trafego geram mais
receita, e qual o cost por aquisicao por canal.

The ability to cross multiple datasets is where Claude Code really stands out. It reads both files, joins by date (or another key), and generates analyzes that would be complex in any other tool.

5. Working with SQL

Claude Code also works with SQL databases. For SQLite, it accesses directly. For PostgreSQL and MySQL, it generates connection scripts.

Claude Code
> abra o banco dados/app.db (SQLite) e me de: schema de
todas as tabelas, total de registros por tabela, e os 10
clientes com maior valor acumulado de pedidos.

Query optimization

Claude Code also helps optimize slow queries:

Claude Code
> esta query esta demorando 8 segundos. Analise o EXPLAIN
e sugira indices e reescrita to otimizar:
SELECT ... FROM orders JOIN products ... WHERE ...

That up there? Skills do automatically.

Every technique you're reading about can be turned into a skill — a command that Claude executes perfectly, every time. The Mega Bundle has 748+ ready-made skills for marketing, dev, SEO, copy and more.

Ver Skills Prontas — $9

6. Creating visualizations and dashboards

Table data is useful, but graphs communicate better. Claude Code can generate visualizations in several ways:

Graphing with matplotlib

Claude Code
> a partir dos dados de vendas, gere graficos:
1. Faturamento mensal (barras)
2. Distribuicao por categoria (pizza)
3. Tendencia de ticket medio (linha)
Salve como imagens PNG em /graficos/

Interactive HTML Dashboard

For something more sophisticated, Claude Code can generate a complete HTML dashboard with Chart.js:

Claude Code
> crie um dashboard HTML interativo com os dados de vendas.
Use Chart.js. Inclua: KPIs no topo (faturamento, ticket
medio, total pedidos), grafico de barras mensal, grafico
de pizza por categoria, e tabela com top 10 produtos.
Salve como dashboard.html

The result is an HTML file that you open in the browser -- with interactive graphics, hover with values, responsive on cell phones. Without installing anything, without a server, just open the file.

7. Generating automated reports

Claude Code can generate reports formatted in several formats:

Format When to use How Claude Code generates
MarkdownInternal reports, documentationGenerates .md with tables, headers and metrics
HTMLShare with clients/teamPage formatted with graphics
CSVData processed for reimportClean export with calculated metrics
JSONIntegration with other systemsStructured data for APIs
Claude Code
> gere um relatorio mensal de marco/2026 em HTML formatado
com: resumo executivo, metricas vs mes anterior (com setas
de crescimento/queda), top produtos, alerta de produtos com
queda >20%, e recomendacoes baseadas nos dados.

8. Automation of recurring analyzes

The most powerful part: transforming manual analyzes into automated scripts that run every week or month.

Reusable script with tometers

Claude Code
> transforme a analise que fizemos em um script CLI que
aceite: --arquivo (caminho do CSV), --periodo (mes/trimestre/
ano), --formato (html/markdown/json), --output (arquivo de
saida). Documente como usar.

Combining with /loop for monitoring

Claude Code
> /loop 1h analise o arquivo vendas-hoje.csv (atualizado
pelo ERP) e me alerte se: faturamento do dia estiver 30%
abaixo da media, algum produto zerou estoque, ou ticket
medio caiu mais de 15%.

Automated monitoring of KPIs in real time. Claude Code runs the analysis every hour and only alerts you when it finds anomalies.

Tip:Specialized skills for data analysis make the difference. Instead of explaining the report format every time, a skill/relatorio-vendasYou already have all the metrics, format and logic configured. The package ofskills dev from minhakills.ioincludes skills for data science, analytics and report automation.

Stop doing it by hand. Let the skills work.

Professionals who use skills deliver 3x faster. It's not theory — it's 748+ skills tested on real projects, organized by area. Install once, use forever.

Get the Mega Bundle — $9
SPECIAL OFFER — LIMITED TIME

The Largest AI Skills Package on the Market

748+ Skills + 12 Bonus Packs + 120,000 Prompts

748+
Professional Skills
Marketing, SEO, Copy, Dev, Social
12
GitHub Bonus Packs
8,107 skills + 4,076 workflows
100K+
AI Prompts
ChatGPT, Claude, Gemini, Midjourney
135
Ready-Made Agents
Automation, data, business, dev

Was $39

$9

One-time payment • Lifetime access • Free updates

GET THE MEGA BUNDLE NOW

Install in 2 minutes • Works with Claude Code, Cursor, ChatGPT • 7-day guarantee

✓ SEO & GEO (20 skills) ✓ Copywriting (34 skills) ✓ Dev (284 skills) ✓ Social Media (170 skills) ✓ n8n Templates (4,076)

FAQ

Yes. Claude Code reads CSV files directly from your file system. It can open the file, understand the column structure, identify data types, and perform full analysis using pandas or Python scripts. You can ask for specific metrics, comparisons between periods, anomaly detection, and more -- all in natural language.

Yes. Claude Code can generate visualizations using matplotlib, plotly or even create interactive HTML dashboards with Chart.js. It creates bar, line, pie, scatter charts and more. For more sophisticated dashboards, it can generate an HTML page complete with interactive charts that you open in the browser.

Yes. Claude Code can connect to SQLite databases directly and execute queries. For PostgreSQL, MySQL and others, it can generate Python scripts that connect to the database, execute queries and process the results. It can also analyze SQL dumps, optimize slow queries and create reports from database data.

Share este artigo X / Twitter LinkedIn Facebook WhatsApp
PTENES