用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/AIDotNet/MoYuCode --skill exceljs命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | exceljs |
| description | 在Node.js中读取、操作和写入Excel电子表格(XLSX)。完全支持样式、公式、图表和大文件流式处理。 |
| metadata | {"short-description":"Excel电子表格操作"} |
| source | {"repository":"https://github.com/exceljs/exceljs","license":"MIT","stars":"14k+"} |
Read, manipulate, and write Excel spreadsheets with full formatting support.
npm install exceljs
import ExcelJS from 'exceljs';
async function createReport() {
const workbook = new ExcelJS.Workbook();
workbook.creator = 'My App';
workbook.created = new Date();
const sheet = workbook.addWorksheet('Sales Report');
// Define columns
sheet.columns = [
{ header: 'ID', key: 'id', width: 10 },
{ header: 'Product', key: 'product', width: 30 },
{ header: 'Quantity', key: 'quantity', width: 15 },
{ header: 'Price', key: 'price', width: 15 },
{ header: 'Total', key: 'total', width: 15 },
];
// Add data
const data = [
{ id: 1, product: 'Widget A', quantity: 100, price: 9.99 },
{ id: 2, product: 'Widget B', quantity: 50, price: 19.99 },
{ id: 3, product: 'Widget C', quantity: 75, price: 14.99 },
];
data.forEach(item => {
sheet.addRow({
...item,
total: { formula: `C${sheet.rowCount + 1}*D${sheet.rowCount + 1}` },
});
});
await workbook.xlsx.writeFile('report.xlsx');
}
async function createStyledReport() {
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet('Styled');
// Header row with styling
const headerRow = sheet.addRow(['Name', 'Email', 'Status']);
headerRow.eachCell(cell => {
cell.fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: '4F46E5' },
};
cell.font = { color: { argb: 'FFFFFF' }, bold: true };
cell.alignment = { horizontal: 'center' };
cell.border = {
top: { style: 'thin' },
bottom: { style: 'thin' },
};
});
// Data rows
const users = [
{ name: 'John', email: 'john@example.com', status: 'Active' },
{ : , : , : },
];
users.( {
row = sheet.([user., user., user.]);
statusCell = row.();
statusCell. = {
: ,
: ,
: { : user. === ? : },
};
});
workbook..();
}
async function readExcel(filePath: string) {
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.readFile(filePath);
const sheet = workbook.getWorksheet('Sheet1');
const data: any[] = [];
sheet?.eachRow((row, rowNumber) => {
if (rowNumber === 1) return; // Skip header
data.push({
id: row.getCell(1).value,
name: row.getCell(2).value,
email: row.getCell(3).value,
});
});
return data;
}
async function streamLargeExcel(data: any[], outputPath: string) {
const workbook = new ExcelJS.stream.xlsx.WorkbookWriter({
filename: outputPath,
useStyles: true,
});
const sheet = workbook.addWorksheet('Data');
sheet.columns = [
{ header: 'ID', key: 'id' },
{ header: 'Value', key: 'value' },
];
// Stream rows (memory efficient)
for (const item of data) {
sheet.addRow(item).commit();
}
await workbook.commit();
}
excel, spreadsheet, xlsx, report, data-export