Skip to content
Back to skills

Chrome插件Excel批量上传工具

ASecurity

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

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
developmentjavascriptjavaapi

Works with

  • api

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill 'chrome插件excel批量上传工具' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Chrome插件Excel批量上传工具?

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

Security grade badge for Chrome插件Excel批量上传工具
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-chrome-excel-meta-skill-evloving/badge)](https://www.skillsdirectory.com/skills/david-li0406-chrome-excel-meta-skill-evloving)

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: "45602adf-6c6e-44de-a4d5-348a71043994"
name: "Chrome插件Excel批量上传工具"
description: "开发Manifest V3版本的Chrome插件,使用xlsx库解析Excel文件,提取指定列数据(如iccid),按固定大小(如1000)分批,转换为文本文件格式,并通过FormData上传到服务器,批次间需延时。"
version: "0.1.0"
tags:
  - "chrome-extension"
  - "manifest-v3"
  - "excel"
  - "batch-upload"
  - "javascript"
triggers:
  - "写个chrome插件导入excel分批上传"
  - "chrome插件批量导入iccid"
  - "manifest v3 excel上传"
  - "chrome插件分次上传数据"
  - "excel转文本文件上传"
---

# 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.page` 或 `webRequestBlocking`)。
- 不要在循环中直接上传而忽略延时要求。
- 不要使用 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转文本文件上传

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…