# Excel Freeze

> |

- **Type:** Skill
- **Install:** `agentstack add skill-yuyy2004-excel-skills-excel-freeze`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [YuYY2004](https://agentstack.voostack.com/s/yuyy2004)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [YuYY2004](https://github.com/YuYY2004)
- **Source:** https://github.com/YuYY2004/excel-skills/tree/main/claude/skills/excel-freeze

## Install

```sh
agentstack add skill-yuyy2004-excel-skills-excel-freeze
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

> This skill follows [[excel-safe-workflow]] four-step method (lightweight: Scout→Execute→Verify).
> 本技能遵循 [[excel-safe-workflow]] 四步法（轻量版：勘察→执行→验证）。

# Excel Freeze Panes / Excel 冻结窗格

## 功能

冻结后，被冻结的行/列在滚动时始终可见。纯 Excel 视图效果，不影响数据。

## 第零步：需求解析

| 用户说 | 冻结位置 | freeze_panes 值 |
|--------|---------|:--:|
| "冻结首行""表头不动""标题行固定" | 仅首行 | `A2` |
| "冻结首列""第一列不动""序号锁定" | 仅首列 | `B1` |
| "冻结首行和首列""表头和序号都不动" | 首行+首列 | `B2` |
| "冻结前3行" | 指定行 | `A4` |
| "取消冻结""解冻""不冻了" | 取消 | `None` |

## 第一步：勘察

```python
from openpyxl import load_workbook

wb = load_workbook('目标文件.xlsx')
ws = wb.active
current = ws.freeze_panes
print(f'当前冻结: {current if current else "无"}')
print(f'工作表: {ws.max_row}行 x {ws.max_column}列')

# 展示表头供确认
for col_idx in range(1, min(6, ws.max_column + 1)):
    h = ws.cell(row=1, column=col_idx).value
    print(f'  表头列{col_idx}: {h}')
```

## 第二步：执行

```python
from openpyxl import load_workbook

# ===== 用户配置 =====
FREEZE = 'A2'  # None=取消 / 'A2'=首行 / 'B1'=首列 / 'B2'=首行+首列 / 'A4'=前三行
# ====================

wb = load_workbook('目标文件.xlsx')
ws = wb.active
ws.freeze_panes = FREEZE
wb.save('目标文件.xlsx')

desc = {
    None: '已取消冻结',
    'A2': '已冻结首行',
    'B1': '已冻结首列',
    'B2': '已冻结首行+首列',
}
print(desc.get(FREEZE, f'已冻结: {FREEZE}'))
```

## 第三步：验证

```python
wb = load_workbook('目标文件.xlsx', read_only=True)
ws = wb.active
print(f'冻结状态: {ws.freeze_panes}')
wb.close()
```

## 注意事项

- **仅影响活动工作表**：如有多个 sheet，需逐个设置
- **合并单元格**：冻结线穿过合并单元格时，合并会被拆分
- **Excel 打开才可见**：openpyxl 只是写入属性，效果需在 Excel 中查看
- **操作前必备份**：遵循 [[excel-safe-workflow]] 第零步——操作前自动备份（时间戳命名）

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [YuYY2004](https://github.com/YuYY2004)
- **Source:** [YuYY2004/excel-skills](https://github.com/YuYY2004/excel-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-yuyy2004-excel-skills-excel-freeze
- Seller: https://agentstack.voostack.com/s/yuyy2004
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
