Install
$ agentstack add skill-yuyy2004-excel-skills-excel-format ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
> This skill follows [[excel-safe-workflow]] four-step method. Must complete Requirement Parsing→Scout before execution, and Verify after. > 本技能遵循 [[excel-safe-workflow]] 四步法。执行前必须完成 需求解析→勘察,执行后验证。
Excel Format Adjustment / Excel 格式调整
第零步:需求解析
自动识别格式需求 / Auto-detect Format Requirements
从用户原话提取所有已明确的格式参数,只追问没说到的。
| 要素 | 常见表述 | 默认值 | |------|---------|--------| | 字体 | "微软雅黑""Arial""Times New Roman" | 不改变 | | 字号 | "12号""10pt""大一点" | 不改变 | | 加粗 | "加粗""粗体""bold" | 不改变 | | 斜体 | "斜体""italic" | 不改变 | | 颜色 | "红色""蓝色""#FF0000" | 不改变 | | 水平对齐 | "居中""靠左""靠右""两端对齐" | 不改变 | | 垂直对齐 | "上下居中""顶部对齐""底部对齐" | 不改变 | | 列宽 | "列宽15""自适应""自动调整宽度" | 不改变 | | 行高 | "行高20""自适应" | 不改变 | | 应用范围 | "表头""全部""E列""第2-10行""数据区" | all(整表) |
解析示例
| 用户说 | 提取 | |--------|------| | "表头加粗居中,字体改成微软雅黑 12号" | 范围=表头, 加粗, 水平居中, 字体=微软雅黑, 字号=12 | | "全部改成 Arial 10号,金额列右对齐" | 范围=全部+金额列, 字体=Arial, 字号=10, 金额列=右对齐 | | "标题行加粗,数据区垂直居中" | 表头=加粗, 数据区=垂直居中 | | "列宽全部自适应" | 全部列, 自适应列宽 | | "把表格美化一下" | 全部, 用默认美化方案 |
默认美化方案(用户只说"美化"时启用)/ Default Beautify Preset
| 区域 | 格式 | |------|------| | 表头(第1行) | 加粗、水平居中、垂直居中、Arial 10pt | | 数据区(第2行起) | 垂直居中、Arial 10pt | | 所有列 | 自适应列宽 |
第一步:勘察
import os, sys
sys.stdout.reconfigure(encoding='utf-8')
from openpyxl import load_workbook
FILE = '目标文件.xlsx'
wb = load_workbook(FILE)
ws = wb.active
print(f'工作表: {ws.title}, 行: {ws.max_row}, 列: {ws.max_column}')
# 展示当前样式状态
print('\n=== 当前格式 ===')
for col_idx in range(1, min(ws.max_column + 1, 8)):
cell = ws.cell(row=1, column=col_idx)
col_letter = chr(64 + col_idx) if col_idx 127 else 1 for c in str(s))
max_len = sample.apply(char_width).max()
# 表头也参与计算
header_len = char_width(str(col_name))
max_len = max(max_len, header_len)
col_letter = get_column_letter(col_idx)
ws.column_dimensions[col_letter].width = min(max_len + 3, 50)
elif COL_WIDTH is not None:
from openpyxl.utils import get_column_letter
for col_idx in cols_to_process:
ws.column_dimensions[get_column_letter(col_idx)].width = COL_WIDTH
# 行高
if ROW_HEIGHT == 'auto':
for row in rows_to_process:
ws.row_dimensions[row].height = None # Excel 自动计算
elif ROW_HEIGHT is not None:
for row in rows_to_process:
ws.row_dimensions[row].height = ROW_HEIGHT
print(f'\n保存中...')
wb.save(FILE)
print(f'完成,耗时 {time.time()-t0:.1f}s')
第三步:验证
wb = load_workbook(FILE, read_only=True, data_only=True)
ws = wb.active
# 验证表头格式
cell = ws.cell(row=1, column=1)
print(f'表头字体: {cell.font.name}/{cell.font.size}pt')
print(f'表头加粗: {cell.font.bold}')
print(f'表头对齐: {cell.alignment.horizontal}/{cell.alignment.vertical}')
# 验证数据区
cell2 = ws.cell(row=2, column=1)
print(f'数据字体: {cell2.font.name}/{cell2.font.size}pt')
# 验证列宽
if ws.column_dimensions['A'].width:
print(f'A列宽: {ws.column_dimensions["A"].width}')
wb.close()
print('✅ 验证完成')
常用预设 / Common Presets
专业报表风 / Professional Report
FONT_NAME='Arial', FONT_SIZE=10, FONT_BOLD=True(header)
H_ALIGN='center'(header+data), V_ALIGN='center'
COL_WIDTH='auto'
中文文档风 / Chinese Document
FONT_NAME='微软雅黑', FONT_SIZE=11
FONT_BOLD=True(header), H_ALIGN='center'(header)
V_ALIGN='center', COL_WIDTH='auto'
仅加粗居中表头 / Bold+Center Header Only
SCOPE='header', FONT_BOLD=True, H_ALIGN='center', V_ALIGN='center'
注意事项
- 列宽自适应对中文友好(中文字符计 2 宽度),上限 40 字符
- 字体可用性取决于 Excel 打开时的系统,Arial/微软雅黑 一般都有
- 合并单元格中的格式需单独处理
- 格式叠加:None 的参数不会被修改,保留原有格式
- 操作前必备份:遵循 [[excel-safe-workflow]] 第零步——操作前自动备份(时间戳命名),成功后保留最新3份,失误后立即删除损坏文件并从备份恢复
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: YuYY2004
- Source: YuYY2004/excel-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.