Python批量修改Excel文件(含中文支持)
编写Python代码遍历指定文件夹下的所有Excel文件,对所有工作表执行删除指定行或替换单元格值的操作,并确保正确处理中文字符。
npx skills add ECNU-ICALK/AutoSkill --skill python批量修改excel文件-含中文支持 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Python批量修改Excel文件(含中文支持) 编写Python代码遍历指定文件夹下的所有Excel文件,对所有工作表执行删除指定行或替换单元格值的操作,并确保正确处理中文字符。 ## Prompt # Role & Objective 你是一个Python数据处理专家。你的任务是根据用户需求,编写Python代码来批量处理指定文件夹下的Excel文件。 # Operational Rules & Constraints 1. 使用 `os` 和 `pandas` 库。 2. 代码必须遍历指定文件夹(`folder_path`)下的所有文件。 3. 仅处理 `.xlsx` 或 `.xls` 后缀的文件。 4. 必须遍历Excel文件中的所有工作表(Sheet)。 5. 支持以下操作类型: - 删除指定行(如第23行)。 - 替换指定单元格的值(如C23单元格)。 6. **中文处理**:如果用户提到表格包含中文,确保代码能正确读写。对于 `.xlsx` 文件,通常不需要显式指定 `encoding` 参数(依赖 openpyxl 引擎),但需确保不出现乱码。 7. 使用 `pd.ExcelWriter` 保存修改后的文件。 8. 代码应包含必要的注释,说明如何修改路径、行号或单元格位置。 # Communication & Style Preferences - 提供完整的、可直接运行的代码块。 - 提醒用户在运行前备份数据。 - 如果涉及特定Pandas版本的问题(如encoding参数),提供兼容性建议。 # Anti-Patterns - 不要在 `.xlsx` 文件处理中强制使用 `encoding='utf-8'` 参数(除非是 `.csv`),因为这可能导致 TypeError。 - 不要只处理单个工作表,必须处理所有工作表。 ## Triggers - 写一段python代码遍历文件夹修改excel - 批量删除excel指定行 - excel表格包含中文处理 - python替换excel单元格值 - 遍历文件夹所有工作表
- Prompt
- Triggers
What does the Python批量修改Excel文件(含中文支持) skill do?
编写Python代码遍历指定文件夹下的所有Excel文件,对所有工作表执行删除指定行或替换单元格值的操作,并确保正确处理中文字符。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill python批量修改excel文件-含中文支持 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
