xse20265272

Parse CSV in the browser using PapaParse, preview customer import rows and perform header mapping. Used when PapaParse, CSV import preview, or customer list parsing is needed.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "xse20265272" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-05933fcc64807b1fd740a7ac2a2b47291eb1f0422fa15f9e71eb48f29b747698. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/xse20265272 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Parse CSV in the browser using PapaParse, preview customer import rows and perform header mapping. Used when PapaParse, CSV import preview, or customer list parsing is needed.

0 Downloads

Introduction source: third_party · user_f1b049da · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: xse20265272
slug: xse20265272
displayName: PapaParse CSV
version: 1.0.0
summary: 用 PapaParse 快速解析 CSV,大批量客户导入前预览与映射。
license: MIT
description: 用 papaparse 在浏览器内解析 CSV,预览客户导入行并做表头映射。当用户要 PapaParse、CSV 导入预览、客户名单解析时使用。

PapaParse CSV

灵感:能力工具箱 papaparse(pkg: papaparse)。

小四原创:选文件 → 解析 → 表格预览 → 表头映射到客户字段;大文件用 worker/分片提示。

何时使用

  • 批量导入客户/线索前先看 CSV
  • Excel 另存 CSV 后前端解析
  • 表头与系统字段不一致要对齐

硬约束

  1. 使用 papaparse;header: true 默认开(无表头则关)。
  2. 编码:优先 UTF-8;乱码时提示用户另存 UTF-8 或尝试 encoding。
  3. 预览默认前 50 行;全量导入需二次确认。
  4. 空文件/无行给出中文错误。
  5. 实现要点注释标 小四原创。

推荐实现

import Papa from 'papaparse'

export type CsvPreview = {
  fields: string[]
  rows: Record<string, string>[]
  errors: string[]
}

// 小四原创:解析 File/文本为预览
export function parseCsvFile(file: File): Promise<CsvPreview> {
  return new Promise((resolve) => {
    Papa.parse(file, {
      header: true,
      skipEmptyLines: true,
      complete: (res) => {
        const fields = res.meta.fields || []
        const rows = (res.data as Record<string, string>[]).slice(0, 50)
        const errors = (res.errors || []).slice(0, 5).map((e) => e.message)
        if (!fields.length && !rows.length) {
          resolve({ fields: [], rows: [], errors: ['CSV 为空或无法解析'] })
          return
        }
        resolve({ fields, rows, errors })
      },
      error: (err) => resolve({ fields: [], rows: [], errors: [String(err)] }),
    })
  })
}

// 小四原创:表头映射
export function mapRows(
  rows: Record<string, string>[],
  mapping: Record<string, string>, // csvHeader -> fieldKey
) {
  return rows.map((r) => {
    const out: Record<string, string> = {}
    for (const [header, key] of Object.entries(mapping)) {
      if (key) out[key] = r[header] ?? ''
    }
    return out
  })
}

Agent 步骤

  1. 文件选择 + parseCsvFile。
  2. 展示 fields 与预览表;配置映射(公司/联系人/手机…)。
  3. 确认后才写入业务库;可接 Zod/Yup 行校验。
  4. 自测:含中文表头 UTF-8 CSV;空文件。

不要做

  • 静默导入上万行不提示内存风险。
  • 把 xlsx 二进制当 CSV 硬解(应先转 CSV 或用专门库)。

附加

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 解决客户批量导入前的 CSV 解析与表头映射痛点
  • 适用于 Excel 转 CSV 后的前端解析场景
Trigger Precision85/100

Highlights

  • 触发词覆盖 PapaParse、CSV 导入预览、客户名单解析等核心场景
Structure and Standards75/100

Areas to improve

  • 缺少端到端完整示例 Reported severity: Minor

    文档结构清晰但缺少一个完整的端到端使用示例

    Recommendation: 补充一个从文件选择到表头映射再到数据导出的完整示例流程

Highlights

  • 文档结构清晰,包含何时使用、硬约束、推荐实现、Agent 步骤等章节
  • frontmatter 完整,版本与描述信息齐全
Execution Reliability75/100

Areas to improve

  • 大文件处理未具体化 Reported severity: Minor

    提到大文件用 worker/分片但未提供具体实现方案

    Recommendation: 补充大文件分片处理的具体实现建议或代码示例

Highlights

  • 工具来源明确(papaparse),参数配置合理
  • 覆盖主要异常场景(空文件、解析错误)并提供中文错误提示
Evidence Verifiability (mean of the first four)80/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.