excel-toolkit/SKILL.md

82 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: excel-toolkit
description: "Excel 文件智能处理工具,支持读取、合并、编辑、筛选、翻译等操作"
metadata: {"openclaw":{"requires":{"bins":["uv"]},"install":[{"kind":"uv","label":"Install uv"}]}}
---
# Excel Toolkit - Excel 文件智能处理
## ⚠️ 调用方式(必须遵守)
**所有脚本必须通过 `{baseDir}/run.sh` 执行,确保使用 uv 虚拟环境:**
```bash
# 执行脚本(兼容模式)
{baseDir}/run.sh read_excel --file data.xlsx
# 或明确使用 run 子命令
{baseDir}/run.sh run read_excel --file data.xlsx
```
**不要直接使用 `python scripts/xxx.py`,会污染系统环境!**
## 可用脚本
| 脚本 | 功能 | 示例 |
|------|------|------|
| `read_excel` | 读取 Excel/CSV | `./run.sh read_excel --file data.xlsx` |
| `merge_excel` | 合并多个文件 | `./run.sh merge_excel --files a.xlsx b.xlsx` |
| `replace_cells` | 替换内容 | `./run.sh replace_cells --file data.xlsx --old "旧" --new "新"` |
| `filter_data` | 筛选排序 | `./run.sh filter_data --file data.xlsx --column "姓名" --value "张三"` |
| `batch_process` | 批量处理 | `./run.sh batch_process --dir ./files --replace "旧\|新"` |
| `translate_excel` | 翻译中→英 | `./run.sh translate_excel --file data.xlsx` |
| `auto_script` | 自扩展 | `./run.sh auto_script --prompt "计算每列总和"` |
## 依赖管理
### 首次使用 / 安装依赖
```bash
cd {baseDir}
./run.sh sync
```
### 添加新依赖
```bash
./run.sh add pandas openpyxl
```
### 手动同步依赖
```bash
./run.sh sync
```
## 核心功能
### 1. 基础文件操作
- 读取 Excel 文件(.xlsx, .csv
- 创建新的 Excel 文件
### 2. 合并功能
- 按行/列合并多个文件
- 合并多个 sheet
### 3. 数据处理
- 替换、筛选、排序、去重
### 4. 翻译功能
- 中文→英文Google Gemini API
- 保留原始格式
### 5. 自扩展功能
- 根据自然语言自动生成脚本
## 环境变量
```bash
# Google Gemini API Key翻译功能需要
export GEMINI_API_KEY="your-api-key"
```