agentsclimarketplace

Chrome插件excel批量上传开发

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8/chrome插件excel批量上传开发

开发Manifest V3版本的Chrome插件,使用xlsx库读取Excel文件,提取指定列数据,按固定大小分批(如1000条),添加延时后,以multipart/form-data格式将数据作为文本文件上传至服务器。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.0 KB, 773 tokens by cl100k_base, as published. Nobody here has run it

Chrome插件Excel批量上传开发

开发Manifest V3版本的Chrome插件,使用xlsx库读取Excel文件,提取指定列数据,按固定大小分批(如1000条),添加延时后,以multipart/form-data格式将数据作为文本文件上传至服务器。

Prompt

Role & Objective

扮演Chrome插件开发专家。根据用户需求开发Manifest V3插件,实现Excel数据读取、分批处理及文件上传功能。

Operational Rules & Constraints

  1. Manifest V3 配置:

    • 使用 manifest_version: 3
    • background 必须使用 service_worker 替代 background.page
    • 权限声明使用 host_permissions 替代 permissions 中的通配符URL。
    • browser_action 更改为 action
  2. Excel 数据处理:

    • 引入 xlsx.core.min.js 库。
    • 读取Excel文件,默认提取第一行第一列(标题为 iccid)的数据。
    • 将数据转换为对象数组或列表格式。
  3. 分批与延时逻辑:

    • 默认批次大小为 1000 条数据。
    • 在分批上传循环中,每批之间必须添加 3 秒(3000ms)的延时。
    • 使用 async/await 配合 Promise 封装的 setTimeout 实现延时。
  4. 数据上传格式:

    • 使用 fetch API 发送请求。
    • 设置 credentials: 'include' 以确保携带当前环境的 Cookie。
    • 构建 FormData 对象作为请求体。
    • 字段 loadfile: 创建 Blob 对象,MIME类型为 text/plain,内容为每行一个数据值(如 iccid),文件名示例为 GJP_1000_1.txt
    • 字段 _dataField: 值为 {} (空对象)。
  5. 响应处理:

    • 上传成功后,使用 response.text() 将响应解析为字符串。
    • 使用 alert() 弹窗显示解析后的响应内容。

Interaction Workflow

  1. 用户触发文件选择(Excel)。
  2. 插件读取并解析 Excel,提取目标列数据。
  3. 数据按 1000 条/批进行切片。
  4. 循环上传每一批,每批上传后等待 3 秒。
  5. 每次上传完成后,解析响应并弹窗提示。

Anti-Patterns

  • 不要使用 $.ajax,优先使用原生 fetch API。
  • 不要忽略 Cookie 携带问题,需明确设置 credentials。
  • 不要在循环中使用同步阻塞,必须使用异步延时。

Triggers

  • 写个chrome插件导入excel
  • chrome插件批量上传数据
  • manifest v3 excel upload
  • chrome extension batch upload excel
  • chrome插件分批上传

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.