360 Secure SkillHub
360 安全技能中心

Csv Parser Local

核心功能:严格遵循RFC4180规则处理CSV,支持解析、生成,可自动检测分隔符、编码,适配Excel等工具特殊特性。典型场景:跨工具CSV数据交互、Excel导出/导入、 legacy系统数据迁移。输入输出为符合规范的CSV内容,解决常见解析失败、格式歧义、Excel公式注入等问题,保障数据跨系统准确传递。

panchenbo
panchenbo
热度 60.31
最近更新 2026-05-11 17:36:23
分类:数据依赖:纯提示词应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add csv-parser-local
Metadata
name
CSV
description
Parse and generate RFC 4180 compliant CSV that works across tools.
metadata
{"clawdbot":{"emoji":"📊","os":["linux","darwin","win32"]}}

Quoting Rules

  • Fields containing comma, quote, or newline MUST be wrapped in double quotes
  • Double quotes inside quoted fields escape as "" (two quotes), not backslash
  • Unquoted fields with leading/trailing spaces—some parsers trim, some don't; quote to preserve
  • Empty field ,, vs empty string ,"",—semantically different; be explicit

Delimiters

  • CSV isn't always comma—detect ; (European Excel), \t (TSV), | in legacy systems
  • Excel exports use system locale delimiter; semicolon common in non-US regions
  • Sniff delimiter from first line but verify—header might not contain special chars

Encoding

  • UTF-8 BOM (0xEF 0xBB 0xBF) breaks naive parsers but Excel needs it for UTF-8 detection
  • When generating for Excel on Windows: add BOM; for programmatic use: omit BOM
  • Latin-1 vs UTF-8 ambiguity—explicitly declare or detect encoding before parsing

Common Parsing Failures

  • Newlines inside quoted fields are valid—don't split on \n before parsing
  • Unescaped quote in middle of field corrupts rest of file—validate early
  • Trailing newline at EOF—some parsers create empty last row; strip or handle
  • Inconsistent column count per row—validate all rows match header count

Numbers & Dates

  • 1,234.56 vs 1.234,56—locale-dependent; standardize or document format
  • Dates: ISO 8601 (2024-01-15) only unambiguous format; 01/02/24 is chaos
  • Leading zeros in numeric fields (007)—quote to preserve or document as string

Excel Quirks

  • Formula injection: fields starting with =, +, -, @ execute as formulas—prefix with ' or tab
  • Long numbers (>15 digits) lose precision—quote and format as text
  • Scientific notation triggered by E in numbers—quote if literal text needed