Install
openclaw skills install finance-agentRecord company expenses and generate summary tables. Data is persisted to a CSV file on Google Drive. Supports adding expenses (date, category, amount, description), generating expense tables (CSV, Markdown), and exporting reports.
openclaw skills install finance-agentfinance-agent 是一个用于记录公司开销并生成汇总表格的 Agent 技能。所有数据持久化到 Google Drive 的 CSV 文件中,确保数据安全可靠。
当用户需要以下操作时,请调用本技能:
调用 add_expense 方法,传入以下参数:
| 参数 | 类型 | 说明 | 示例 |
|---|---|---|---|
date | str | 开销日期,格式为 YYYY-MM-DD | "2026-02-28" |
category | str | 开销类别 | "Travel", "Meals", "Office Supplies" |
amount | float | 开销金额 | 250.75 |
description | str | 开销描述 | "Flight to client meeting" |
from finance_agent import FinanceAgent
agent = FinanceAgent()
agent.add_expense('2026-02-28', 'Travel', 250.75, 'Flight to client meeting')
调用 generate_expense_table 方法,通过 output_format 参数指定输出格式:
| 格式 | 说明 |
|---|---|
"dataframe" | 返回 Pandas DataFrame 对象(默认) |
"csv" | 返回 CSV 格式字符串 |
"markdown" | 返回 Markdown 格式表格字符串 |
# 生成 Markdown 格式报告
markdown_table = agent.generate_expense_table(output_format='markdown')
print(markdown_table)
# 生成 CSV 格式报告
csv_data = agent.generate_expense_table(output_format='csv')
调用 export_report 方法,将报告保存到指定路径:
agent.export_report(output_path='expense_report.csv', output_format='csv')
本技能使用 CSV 文件进行数据持久化。默认情况下,数据保存在 expense_report.csv 文件中。
若需将数据同步到 Google Drive,请确保已正确配置 GDRIVE_CREDENTIALS 环境变量,并使用 Google Drive API 将 CSV 文件上传到指定目录。
| 变量名 | 说明 |
|---|---|
GDRIVE_CREDENTIALS | Google Drive API 凭据文件路径(JSON 格式) |
finance-agent/
├── SKILL.md # 本文件,技能说明文档
├── finance_agent.py # 技能主逻辑实现
└── expense_report.csv # 开销数据持久化文件(示例数据)
以下是 Markdown 格式的开销汇总表格示例:
| Date | Category | Amount | Description |
|---|---|---|---|
| 2026-02-27 | Office Supplies | 55.0 | Printer paper and ink |
| 2026-02-26 | Travel | 250.75 | Flight to client meeting |
| 2026-02-25 | Meals | 45.5 | Lunch with a potential partner |