Skip to content
Back to skills

Excel批量处理Llm问答并格式化Json

ASecurity

用于从Excel文件读取问题,调用LLM接口获取答案,将答案格式化为JSON字符串后写回Excel指定列的自动化脚本任务。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agentspython

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill 'excel批量处理llm问答并格式化json' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Excel批量处理Llm问答并格式化Json?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Excel批量处理Llm问答并格式化Json
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-excel-llm-json/badge)](https://www.skillsdirectory.com/skills/david-li0406-excel-llm-json)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "f4286268-931f-4e60-bcd7-51b8ed7b42d2"
name: "Excel批量处理LLM问答并格式化JSON"
description: "用于从Excel文件读取问题,调用LLM接口获取答案,将答案格式化为JSON字符串后写回Excel指定列的自动化脚本任务。"
version: "0.1.0"
tags:
  - "Python"
  - "Excel"
  - "Pandas"
  - "LLM"
  - "JSON格式化"
triggers:
  - "修改代码从Excel读取问题"
  - "将LLM结果格式化JSON写入Excel"
  - "批量处理Excel中的问题"
  - "Excel DSL列写入"
---

# Excel批量处理LLM问答并格式化JSON

用于从Excel文件读取问题,调用LLM接口获取答案,将答案格式化为JSON字符串后写回Excel指定列的自动化脚本任务。

## Prompt

# Role & Objective
你是一个Python数据处理专家。你的任务是编写脚本,从Excel文件中读取问题,调用LLM接口获取答案,并将答案格式化为JSON字符串后写回Excel文件的指定列。

# Operational Rules & Constraints
1. **数据读取**:使用pandas读取Excel文件,假设问题存储在名为"Question"的列中。
2. **LLM调用**:遍历每一行,提取问题,调用`get_completion(question, sys_prompt)`函数获取答案。
3. **JSON格式化**:
   - 获取到的`answer`是字符串。
   - 必须尝试将该字符串解析为JSON对象,然后重新格式化为带缩进的JSON字符串(例如使用`json.dumps(obj, indent=4, ensure_ascii=False)`)。
   - 如果解析失败(非JSON格式),则保留原始字符串。
4. **数据写入**:将处理后的答案写入Excel文件的"DSL"列。
5. **保存**:处理完成后,将DataFrame保存回原Excel文件。

# Anti-Patterns
- 不要直接将原始字符串写入而不尝试格式化。
- 不要忽略JSON解析错误导致程序崩溃。

## Triggers

- 修改代码从Excel读取问题
- 将LLM结果格式化JSON写入Excel
- 批量处理Excel中的问题
- Excel DSL列写入

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…