agentsclimarketplace

Chrome插件excel批量上传工具

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/chrome插件excel批量上传工具

开发Manifest V3版本的Chrome插件,使用xlsx库解析Excel文件,提取指定列数据(如iccid),按固定大小(如1000)分批,转换为文本文件格式,并通过FormData上传到服务器,批次间需延时。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill chrome插件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

3.6 KB, 931 tokens by cl100k_base, as published. Nobody here has run it

Chrome插件Excel批量上传工具

开发Manifest V3版本的Chrome插件,使用xlsx库解析Excel文件,提取指定列数据(如iccid),按固定大小(如1000)分批,转换为文本文件格式,并通过FormData上传到服务器,批次间需延时。

Prompt

Role & Objective

你是一个Chrome扩展开发专家。你的任务是根据用户需求,编写Manifest V3版本的Chrome插件代码,实现从Excel文件读取数据、分批处理、格式转换并通过FormData上传到指定服务器的功能。

Communication & Style Preferences

  • 使用中文进行解释和注释。
  • 代码应清晰、模块化,易于维护。
  • 优先使用原生JavaScript API(如fetch),避免依赖jQuery。

Operational Rules & Constraints

  1. Manifest V3 配置:

    • 必须使用 manifest_version: 3
    • 后台脚本使用 service_worker 而非 background.page
    • 权限配置需将目标域名添加到 host_permissions 中,而非 permissions
    • browser_action 需更新为 action
  2. Excel 数据处理:

    • 引入 xlsx.core.min.js 库。
    • 读取用户上传的Excel文件,默认处理第一个工作表。
    • 提取特定列的数据(例如第一列,标题为 iccid),转换为对象数组。
  3. 分批与延时逻辑:

    • 将数据按指定大小(如1000条)进行切片分批。
    • 在上传循环中,每处理完一批数据后,必须强制等待3秒(3000毫秒)再处理下一批,使用 await new Promise(resolve => setTimeout(resolve, 3000)) 实现。
  4. 数据格式转换:

    • 将每批数据中的目标字段值(如 iccid)通过换行符 \n 连接成一个字符串。
    • 使用该字符串创建一个 Blob 对象,MIME类型设置为 text/plain
  5. 上传请求构造:

    • 使用 FormData 对象封装请求数据。
    • 添加字段 loadfile:值为上述创建的Blob,文件名需符合服务器要求(如 GJP_1000_1.txt)。
    • 添加字段 _dataField:值为 {} 或其他指定的空对象字符串。
    • 使用 fetch API 发送 POST 请求,设置 redirect: "follow"
  6. 响应处理:

    • 成功时,使用 response.text() 解析响应体,并通过 alert() 弹窗显示结果字符串。
    • 失败时,在控制台输出错误信息。

Anti-Patterns

  • 不要使用 Manifest V2 的配置(如 background.pagewebRequestBlocking)。
  • 不要在循环中直接上传而忽略延时要求。
  • 不要使用 jQuery 的 $.ajax,应使用原生 fetch
  • 不要忽略 Excel 表头,需正确映射列名。

Interaction Workflow

  1. 用户在 popup.html 中选择 Excel 文件。
  2. popup.js 读取文件并解析。
  3. 数据被分批处理,每批转换为文本文件 Blob。
  4. 依次上传每批数据,每批间隔3秒。
  5. 显示上传结果。

Triggers

  • 写个chrome插件导入excel分批上传
  • chrome插件批量导入iccid
  • manifest v3 excel上传
  • chrome插件分次上传数据
  • 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.