Community生产力与协作github.com

shuangying0001-beep/tabular-exporter

记录数据一键导出 Excel/CSV(带样式):表头冻结、斑马纹、是/否,中文防乱码。适合运营报表、数据导出、日志归档。

tabular-exporter 是什么?

tabular-exporter is a Claude Code agent skill that 记录数据一键导出 Excel/CSV(带样式):表头冻结、斑马纹、是/否,中文防乱码。适合运营报表、数据导出、日志归档。.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add shuangying0001-beep/tabular-exporter

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

tabular-exporter — Export Array of Records as Tables

Turn any "array of objects" into styled Excel or BOM-prefixed CSV. Zero dependencies: xlsx is generated in pure JS (ZIP STORE method, built-in CRC32), CSV comes with UTF-8 BOM. No npm install required.

Use Cases

  • Export structured data from collections or API responses as deliverable Excel / CSV
  • Backend "export" functionality, data reports, data migration
  • Need Chinese characters without garbled output, styled headers, frozen first row

Provided Functions

FunctionDescription
exportToExcel(rows, columns, opts?)Generate styled xlsx (Buffer), optionally write to filePath
exportToCsv(rows, columns, opts?)Generate BOM-prefixed CSV string
exportTable(rows, columns, opts?)Unified entry point, opts.format = 'xlsx' | 'csv'
columnsFromKeys(keys, widths?)Quickly generate column config from a list of keys

columns has the form [{ key, header?, width? }], rows is an array of objects.

Style features:

  • Header: bold + white text + blue background (4472C4)
  • Frozen first row
  • Zebra striping (even rows light gray background)
  • Booleans → Yes/No; arrays → line breaks; objects → JSON
  • xlsx compatible with Excel / WPS / LibreOffice (standard OOXML)

Usage

import { exportTable, columnsFromKeys } from './scripts/exporter.mjs';

const rows = [
  { title: 'Wireless Mouse', price: 99.5, inStock: true },
  { title: 'Mechanical Keyboard', price: 299, inStock: false },
];
const columns = [
  { key: 'title', header: 'Title', width: 40 },
  { key: 'price', header: 'Price', width: 12 },
  { key: 'inStock', header: 'In Stock', width: 8 },
];

// Export xlsx (write to file directly)
exportTable(rows, columns, { format: 'xlsx', filePath: 'out.xlsx', sheetName: 'Products' });

// Export csv (returns string)
const csv = exportTable(rows, columns, { format: 'csv' });

Self-test

node scripts/exporter.mjs --selftest

相关技能