exceljs
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 "exceljs" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-129deb53fd47cc1cb9a23b0e14ef1aa14d62cef69d2598b53c91525d960291f2. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Use ExcelJS to generate and parse Excel spreadsheets: create workbooks with multiple sheets, styled cells, formulas, charts, images, and conditional formatting. Suitable for exporting application data to .xlsx files, building financial reports, parsing uploaded spreadsheets, or creating data import/export pipelines.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Software, accounts and paid services
- ```bash
- Testing
- Not tested
Browse files
Frontmatter
name: exceljs
description: >-
Generate and parse Excel spreadsheets with ExcelJS — create workbooks with
multiple sheets, styled cells, formulas, charts, images, and conditional
formatting. Use when tasks involve exporting application data to .xlsx,
building financial reports, parsing uploaded spreadsheets, or creating
data import/export pipelines.
license: Apache-2.0
compatibility: "Node.js 14+ or browser"
metadata:
author: terminal-skills
version: "1.0.0"
category: documents
tags: ["excel", "xlsx", "spreadsheet", "exceljs", "reports"]ExcelJS
Read and write Excel files in Node.js. Full support for styles, formulas, images, and streaming.
Setup
# Install ExcelJS for spreadsheet generation and parsing.
npm install exceljs
Creating a Workbook
// src/excel/create.ts — Create an Excel workbook with a styled header row and data.
import ExcelJS from "exceljs";
const workbook = new ExcelJS.Workbook();
workbook.creator = "Report System";
workbook.created = new Date();
const sheet = workbook.addWorksheet("Sales Data", {
properties: { tabColor: { argb: "FF3498DB" } },
});
// Define columns
sheet.columns = [
{ header: "Product", key: "product", width: 25 },
{ header: "Revenue", key: "revenue", width: 15 },
{ header: "Units Sold", key: "units", width: 12 },
{ header: "Growth", key: "growth", width: 12 },
];
// Style header row
sheet.getRow(1).font = { bold: true, color: { argb: "FFFFFFFF" } };
sheet.getRow(1).fill = {
type: "pattern",
pattern: "solid",
fgColor: { argb: "FF3498DB" },
};
// Add data
const data = [
{ product: "Widget Pro", revenue: 45000, units: 1200, growth: 0.12 },
{ product: "Gadget Plus", revenue: 32000, units: 800, growth: 0.08 },
{ product: "Tool Basic", revenue: 18000, units: 2400, growth: -0.03 },
];
data.forEach((row) => sheet.addRow(row));
// Format numbers
sheet.getColumn("revenue").numFmt = "$#,##0";
sheet.getColumn("growth").numFmt = "0.0%";
await workbook.xlsx.writeFile("sales-report.xlsx");
Formulas
// src/excel/formulas.ts — Add formulas for totals, averages, and derived values.
import ExcelJS from "exceljs";
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet("Financials");
sheet.columns = [
{ header: "Item", key: "item", width: 20 },
{ header: "Q1", key: "q1", width: 12 },
{ header: "Q2", key: "q2", width: 12 },
{ header: "Total", key: "total", width: 12 },
];
sheet.addRow({ item: "Revenue", q1: 100000, q2: 120000 });
sheet.addRow({ item: "Expenses", q1: 80000, q2: 85000 });
sheet.addRow({ item: "Profit" });
// Formula references
sheet.getCell("D2").value = { formula: "B2+C2" } as any;
sheet.getCell("D3").value = { formula: "B3+C3" } as any;
sheet.getCell("B4").value = { formula: "B2-B3" } as any;
sheet.getCell("C4").value = { formula: "C2-C3" } as any;
sheet.getCell("D4").value = { formula: "D2-D3" } as any;
await workbook.xlsx.writeFile("financials.xlsx");
Conditional Formatting
// src/excel/conditional.ts — Highlight cells based on value thresholds.
import ExcelJS from "exceljs";
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet("KPIs");
sheet.columns = [
{ header: "Metric", key: "metric", width: 20 },
{ header: "Value", key: "value", width: 15 },
];
sheet.addRows([
{ metric: "Uptime", value: 99.9 },
{ metric: "Error Rate", value: 2.3 },
{ metric: "Response Time (ms)", value: 450 },
]);
// Green for values above target, red for below
sheet.addConditionalFormatting({
ref: "B2:B4",
rules: [
{
type: "cellIs",
operator: "greaterThan",
formulae: [95],
style: { fill: { type: "pattern", pattern: "solid", bgColor: { argb: "FF27AE60" } } },
priority: 1,
},
],
});
await workbook.xlsx.writeFile("kpis.xlsx");
Reading Excel Files
// src/excel/read.ts — Parse an uploaded Excel file and extract data as objects.
import ExcelJS from "exceljs";
export async function parseExcel(filePath: string) {
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.readFile(filePath);
const sheet = workbook.getWorksheet(1)!;
const headers: string[] = [];
const rows: Record<string, any>[] = [];
sheet.eachRow((row, rowNumber) => {
if (rowNumber === 1) {
row.eachCell((cell) => headers.push(String(cell.value)));
} else {
const obj: Record<string, any> = {};
row.eachCell((cell, colNumber) => {
obj[headers[colNumber - 1]] = cell.value;
});
rows.push(obj);
}
});
return rows;
}
Streaming Large Files
// src/excel/stream.ts — Write large datasets without holding everything in memory.
// Uses ExcelJS streaming writer for millions of rows.
import ExcelJS from "exceljs";
import fs from "fs";
export async function streamLargeExport(data: AsyncIterable<any[]>, outputPath: string) {
const workbook = new ExcelJS.stream.xlsx.WorkbookWriter({
stream: fs.createWriteStream(outputPath),
useStyles: true,
});
const sheet = workbook.addWorksheet("Data");
sheet.columns = [
{ header: "ID", key: "id", width: 10 },
{ header: "Name", key: "name", width: 30 },
{ header: "Value", key: "value", width: 15 },
];
for await (const batch of data) {
for (const row of batch) {
sheet.addRow(row).commit();
}
}
sheet.commit();
await workbook.commit();
}Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 Excel 文件生成与解析能力,支持样式、公式、条件格式、流式处理等高级特性
- 适用于财务报告、数据导出/导入、报表生成等高频刚需场景,具有广泛实用价值
Highlights
- description 明确描述使用场景,覆盖导出数据、财务报告、解析上传表格、数据流水线等多种变体
- 触发词边界清晰,不易与其他 Skill 重叠
Highlights
- 文档结构清晰,分章节涵盖创建工作簿、公式、条件格式、读取文件、流式处理等核心功能
- 每部分含完整 TypeScript 代码示例,frontmatter 完整,单文件未超 500 行
Highlights
- 工具来源明确(ExcelJS),参数正确,涵盖主要使用场景
- 流式处理避免内存溢出,读取文件有完整解析逻辑,无不可逆操作
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.
-
Read local files
Limit access to selected files or the project directory. Avoid unrelated private records, secrets and configuration files.
Mentioned in main document · lines 150 -
Save or modify files
Confirm the output directory and whether existing files will be replaced. Back up important files and prefer a new output directory.
Mentioned in main document · lines 72, 102, 139 -
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 26
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
```bash
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.