| name | data-analyzer |
| description | Data analysis tool for Excel, CSV, Word, PDF, TXT, Markdown files. Use when user needs to analyze, summarize, or compare data from multiple files. Supports folder scanning, data aggregation, statistics, report generation in Markdown/Excel/Word/PDF. Multi-language support. 数据分析、文件夹分析、Excel分析。 |
| version | 1.0.9 |
| license | MIT-0 |
| metadata | {"openclaw":{"emoji":"📊","requires":{"bins":["python3"],"env":[]}}} |
| dependencies | pip install pandas openpyxl python-docx pymupdf matplotlib |
Data Analyzer
Analyze and summarize data from Excel, CSV, Word, and PDF files.
Features
- 📊 Multi-Format Input: Excel, CSV, Word, PDF, TXT, Markdown
- 📁 Folder Scan: Analyze entire folders
- 📈 Statistics: Sum, average, trends
- 🔄 Data Merge: Combine multiple files
- 📉 Visualization: Generate charts
- 📋 Multi-Format Output: Markdown, Excel, Word, PDF
- 🌍 Multi-Language: English, Chinese output
Trigger Conditions
- "Analyze this folder" / "分析这个文件夹"
- "Compare these Excel files" / "对比这些Excel"
- "Summarize the data" / "汇总数据"
- "data-analyzer"
Python Code
import os
import pandas as pd
from pathlib import Path
from docx import Document
import fitz
class DataAnalyzer:
def __init__(self, folder_path):
self.folder = Path(folder_path)
self.files = self._scan_files()
def _scan_files(self):
"""Scan folder for supported files"""
files = {
'excel': [], 'csv': [], 'word': [],
'pdf': [], 'txt': [], 'markdown': []
}
for f in self.folder.rglob('*'):
ext = f.suffix.lower()
if ext in ['.xlsx', '.xls']:
files['excel'].append(str(f))
elif ext == '.csv':
files['csv'].append(str(f))
elif ext == '.docx':
files['word'].append(str(f))
elif ext == '.pdf':
files['pdf'].append((f))
ext == :
files[].append((f))
ext [, ]:
files[].append((f))
files
():
df = pd.read_excel(file_path)
{: (df), : (df.columns), : df}
():
df = pd.read_csv(file_path)
{: (df), : (df.columns), : df}
():
doc = Document(file_path)
text = .join([p.text p doc.paragraphs p.text.strip()])
{: (doc.paragraphs), : text}
():
doc = fitz.(file_path)
text =
page doc:
text += page.get_text()
result = {: (doc), : text}
doc.close()
result
():
(file_path, , encoding=) f:
text = f.read()
{: (text.split()), : text}
():
(file_path, , encoding=) f:
text = f.read()
{: (text.split()), : text}
():
ext = Path(file_path).suffix.lower()
ext [, ]:
.analyze_excel(file_path)
ext == :
.analyze_csv(file_path)
ext == :
.analyze_word(file_path)
ext == :
.analyze_pdf(file_path)
ext == :
.analyze_txt(file_path)
ext [, ]:
.analyze_markdown(file_path)
:
{: }
():
summary = {: , : []}
ftype, flist .files.items():
fpath flist:
:
analysis = .analyze_file(fpath)
summary[].append({
: os.path.basename(fpath),
: ftype,
: analysis
})
summary[] +=
Exception e:
summary[].append({
: os.path.basename(fpath),
: ftype,
: (e)
})
summary
Usage
User: "Analyze all Excel files in this folder"
Agent: 使用 DataAnalyzer 扫描并分析
User: "Compare these CSV files"
Agent: 读取并对比数据
User: "Generate a data report"
Agent: 生成分析报告
Notes
- Supports .xlsx, .csv, .docx, .pdf
- Local processing, no data uploaded
- Cross-platform compatible