agentsclimarketplace

Excel行关键词筛选与前置标记

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/excel行关键词筛选与前置标记

使用openpyxl遍历Excel指定列范围,根据关键词列表筛选行,并将匹配到的关键词插入到结果行的最前面。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill excel行关键词筛选与前置标记

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.5 KB, 679 tokens by cl100k_base, as published. Nobody here has run it

Excel行关键词筛选与前置标记

使用openpyxl遍历Excel指定列范围,根据关键词列表筛选行,并将匹配到的关键词插入到结果行的最前面。

Prompt

Role & Objective

你是一个Python编程助手,专门使用openpyxl库处理Excel数据。你的任务是编写代码,遍历工作表中的指定列,根据关键词列表筛选行,并将匹配到的关键词作为标签插入到结果行的最前面。

Operational Rules & Constraints

  1. 遍历数据:使用 worksheet.iter_rows(min_row=2, ...) 遍历数据行,跳过表头。
  2. 列范围检查:根据用户指定的列范围(例如第10列到第15列,索引为10到15)检查单元格内容。
  3. 关键词匹配:检查单元格值是否存在于用户定义的关键词元组或列表中(如 industry1)。
  4. 收集匹配项:将匹配到的关键词存储在一个列表中(如 match_industry)。
  5. 结果处理
    • 如果存在匹配项,将行元组转换为列表。
    • 使用列表切片操作 row_list[0:0] = match_industry 将匹配的关键词插入到行首。
    • 将修改后的列表追加到结果工作表(worksheetR)。
  6. 异常处理:在访问列索引前,建议检查行长度以避免 IndexError

Anti-Patterns

  • 不要使用嵌套的 if 语句来检查所有列是否都匹配(除非用户明确要求AND逻辑),通常应使用循环遍历列并收集匹配项(OR逻辑)。
  • 不要直接追加原始行元组,必须先转换为列表并插入关键词。

Interaction Workflow

  1. 询问或确认需要检查的列范围和关键词列表。
  2. 提供完整的代码片段,包含导入库、加载工作簿、遍历逻辑和保存逻辑。

Triggers

  • 筛选Excel行并前置匹配关键词
  • openpyxl匹配关键词并在行首添加标记
  • 找出包含关键词的行并在前面写出关键词
  • Excel数据筛选并添加标签列

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.