Prerequisites

  • OpenClaw v1.0.0+ installed
  • API key for a capable reasoning model (GPT-4o or Claude 3.5+ recommended)
  • Data files in CSV, JSON, or text format
  • Optional: Python + pandas for pre/post-processing

CSV Data Analysis

# Get statistical summary of a CSV
openclaw run "Analyze this CSV: describe each column, find min/max/mean, identify outliers" \
  --file sales-data.csv \
  --output analysis.md

# Trend analysis
openclaw run "Analyze monthly revenue trends, identify growth/decline periods, and forecast next 3 months" \
  --file revenue.csv

Generating Analysis Scripts

# Generate a pandas analysis script
openclaw run "Write a Python pandas script to: load this CSV, clean null values, group by category, plot a bar chart, save to report.html" \
  --file data.csv \
  --output analyze.py

# Run the generated script
python analyze.py

Data Cleaning Automation

# Identify and fix data quality issues
openclaw run "This CSV has data quality issues. Identify: duplicate rows, missing values, inconsistent formats, outliers. Output a cleaned version." \
  --file messy-data.csv \
  --format csv \
  --output cleaned-data.csv

# Normalize and deduplicate
openclaw run "Normalize all phone numbers to E.164 format, deduplicate records by email" \
  --file contacts.csv \
  --output contacts-clean.csv

Log File Analysis

# Analyze server logs for patterns
tail -n 10000 /var/log/nginx/access.log | \
  openclaw run "Analyze these nginx logs: top 10 URLs, error rate, suspicious IPs, peak traffic hours" \
  --output log-report.md

# Error pattern detection
cat app.log | openclaw run \
  "Find all ERROR and CRITICAL lines, group by error type, identify the most frequent issues"

Automated Reports

#!/bin/bash
# weekly-report.sh
cat <<'EOF' | openclaw run --stdin --output weekly-report.md
Analyze the following data and generate a weekly business intelligence report with:
1. Executive summary (3 sentences)
2. KPI table (revenue, users, conversion rate)
3. Issues requiring attention
4. Recommendations for next week
$(cat metrics.json)
EOF

Data Visualization Descriptions

OpenClaw can generate Matplotlib or Plotly code from natural language data descriptions:

# Generate chart code from data description
openclaw run "Write Python Matplotlib code to create: a bar chart of monthly revenue from Jan-Dec 2025. Values: [12k,15k,18k,22k,19k,25k,28k,30k,26k,31k,35k,40k]. Save as sales-chart.png." \
  --output plot.py
python plot.py
# Generate a comparison chart
cat metrics.json | openclaw run "Write Python code to plot: a grouped bar chart comparing Q1 vs Q2 performance for 4 products. Use Matplotlib, dark background, save as comparison.png." \
  --format python \
  --output comparison-chart.py

AI-Assisted SQL Queries

Describe the data insight you need in plain language and get a SQL query:

# Generate a SQL query from natural language
openclaw run "Write a SQL query that: finds users who signed up in the last 30 days, made at least 2 purchases, and have not opted out of marketing. Tables: users (id, email, created_at, opt_out), orders (id, user_id, created_at)." \
  --format sql

# Explain an existing query
openclaw run "Explain this SQL query in plain English and identify any performance issues" \
  --file complex-query.sql

Anomaly Detection

Use OpenClaw to flag unusual patterns in logs, metrics, or datasets:

# Find anomalies in application logs
tail -n 1000 /var/log/app.log | \
  openclaw run "Identify unusual patterns, error spikes, or suspicious activity. List top 5 anomalies with severity."

# Compare this week's metrics against last week
openclaw run "Compare week-over-week metrics. Flag: any metric deviating >20% from previous week." \
  --file this-week.csv \
  --context-file last-week.csv

Try It Yourself

Analyse real data with OpenClaw — no pandas or SQL required:

1 — Analyse a CSV file instantly

# Download a sample CSV and analyse it
curl -o /tmp/sample-sales.csv https://raw.githubusercontent.com/datasets/gdp/master/data/gdp.csv

openclaw run "Analyse this CSV file: describe the columns, show key statistics (min/max/mean), identify any trends or anomalies, and give 3 business insights."   --file /tmp/sample-sales.csv

Expected output: A structured analysis with column descriptions, statistical summary, trend observations, and actionable insights — all in plain English.

2 — Query structured data in natural language

# Ask questions about your data without writing SQL
openclaw run "From this CSV, answer these questions: 1) Which country had the highest GDP growth rate? 2) What was the average GDP in 2020? 3) Which years show a significant decline?"   --file /tmp/sample-sales.csv   --output data-qa.md

3 — Convert data to a different format

# Convert CSV to a formatted Markdown table (e.g. for a README or report)
openclaw run "Convert this CSV data to a well-formatted Markdown table. Include only the top 10 rows sorted by value descending."   --file /tmp/sample-sales.csv   --output table.md

cat table.md
ℹ️
For large CSV files (10,000+ rows), use --chunk-size 500 to process the data in batches and avoid context window limits.

What's Next