excel-sort

excel-sort is a skill for Claude Code, Codex from YuYY2004/excel-skills. It costs 114 tokens per session (1,898 once invoked), scanned A, original, MIT.

An Excel data-sorting tool that arranges rows by one or more columns. It supports ascending or descending order for numbers, dates, and text.

In plain words
What is it for?
Use it to sort spreadsheets by dates, amounts, categories, or other columns, including multi-column sorts such as category first and date second.
Why use it?
It helps avoid sorting the wrong column or range and checks that the final order is correct.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to sort spreadsheets by dates, amounts, categories, or other columns, including multi-column sorts such as category first and date second.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yuyy2004/excel-skills/excel-sort
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add YuYY2004/excel-skills --skill excel-sort
Clone the repo
git clone --depth 1 https://github.com/YuYY2004/excel-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for excel-sort

README.md
[![agentmods](https://agentmods.dev/badge/skills/yuyy2004/excel-skills/excel-sort/github.svg)](https://agentmods.dev/skills/yuyy2004/excel-skills/excel-sort)
Your own site
<a href="https://agentmods.dev/skills/yuyy2004/excel-skills/excel-sort"><img src="https://agentmods.dev/badge/skills/yuyy2004/excel-skills/excel-sort/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for excel-sort

Your own site · 80×15
<a href="https://agentmods.dev/skills/yuyy2004/excel-skills/excel-sort"><img src="https://agentmods.dev/badge/skills/yuyy2004/excel-skills/excel-sort.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 114 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,898 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00114 $0.01898
Opus 5 $0.00057 $0.00949
Sonnet 5 $0.00023 $0.00380
Haiku 4.5 $0.00011 $0.00190

Measured 9d ago against content hash ab96c6b6ef39, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

excel-sort scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

claude/skills/excel-sort/SKILL.md · 182 lines

How it starts

The opening of the file, as written. The whole thing — 182 lines — stays where its author put it; the contents beside it link to each section on GitHub.

This skill follows [[excel-safe-workflow]] four-step method. Must scout and confirm sort column and range before execution, and verify correct order after. 本技能遵循 [[excel-safe-workflow]] 四步法。执行前必须勘察确认排序列和范围,执行后验证顺序正确。

Excel Sort / Excel 排序

第零步:需求解析

要素 常见表述 默认值
排序列 "按公开日排序""E列排序" 必须明确
方向 "从小到大""升序""asc" → asc;"从大到小""降序""desc" → desc asc
多列排序 "先按A列再按B列" 按优先级排列
数据范围 默认包含表头行(第1行),自动识别数据区 有表头

解析示例

用户说 提取
"按公开日升序排列" 列=公开日, asc
"按金额从大到小排序" 列=金额, desc
"先按类别排,再按日期排" 列=[类别,日期], 默认asc

第一步:勘察

from openpyxl import load_workbook

FILE = '目标文件.xlsx'
wb = load_workbook(FILE)
ws = wb.active
print(f'{ws.max_row}行 x {ws.max_column}列')

# 定位排序列
print('\n=== 表头 ===')
for col_idx in range(1, ws.max_column + 1):
    h = ws.cell(row=1, column=col_idx).value
    if h:
        print(f'  列{col_idx}: {h}')

# 确认数据类型
sort_col = None  # 排序列号
print(f'\n排序列数据样本:')
for row in [2, 3, 4, ws.max_row // 2, ws.max_row]:
    v = ws.cell(row=row, column=sort_col).value
    print(f'  行{row}: {type(v).__name__} = {repr(v)[:40]}')

wb.close()

第二步:执行

策略:大文件统一走「读格式→pandas处理→刷回格式」三步。

import pandas as pd
from openpyxl import load_workbook
from openpyxl.styles import Font, Alignment, PatternFill
from copy import copy

FILE = '目标文件.xlsx'
SORT_COLS = [('列名或列号', 'asc')]  # asc/desc
HEADER_ROW = 1

# ====== 第一步:读取格式 ======
print('① 读取格式...')
wb = load_workbook(FILE)
ws = wb.active

header_formats, data_formats, col_widths = {}, {}, {}
for col in range(1, ws.max_column + 1):
    header_formats[col] = {
        'font': copy(ws.cell(row=HEADER_ROW, column=col).font),
        'alignment': copy(ws.cell(row=HEADER_ROW, column=col).alignment),
        'fill': copy(ws.cell(row=HEADER_ROW, column=col).fill),
    }
    data_formats[col] = {
        'font': copy(ws.cell(row=HEADER_ROW + 1, column=col).font),
        'alignment': copy(ws.cell(row=HEADER_ROW + 1, column=col).alignment),
        'fill': copy(ws.cell(row=HEADER_ROW + 1, column=col).fill),
    }
    col_letter = chr(64 + col) if col <= 26 else ''
    if col_letter and col_letter in ws.column_dimensions:
        col_widths[col] = ws.column_dimensions[col_letter].width

freeze = ws.freeze_panes
col_names = [ws.cell(row=HEADER_ROW, column=c).value for c in range(1, ws.max_column + 1)]
wb.close()

# ====== 第二步:pandas 排序 ======
print('② 排序...')
df = pd.read_excel(FILE)

# 列名归一化
sort_by = []
ascending = []
for spec, direction in SORT_COLS:
    name = col_names[spec - 1] if isinstance(spec, int) else spec
    sort_by.append(name)
    ascending.append(direction == 'asc')

df = df.sort_values(by=sort_by, ascending=ascending)
print(f'已排序: {list(zip(sort_by, ["asc" if a else "desc" for a in ascending]))}')

# ====== 第三步:写回 + 轻量格式 ======
print('③ 写回并恢复关键格式...')
df.to_excel(FILE, index=False)

wb = load_workbook(FILE)
ws = wb.active

# 核心格式(始终恢复,秒级)
for col in range(1, ws.max_column + 1):
    cl = chr(64 + col) if col <= 26 else ''
    if col in header_formats:
        hf = header_formats[col]
        c = ws.cell(row=HEADER_ROW, column=col)
        c.font, c.alignment, c.fill = hf['font'], hf['alignment'], hf['fill']
    if cl and col in col_widths and col_widths[col]:
        ws.column_dimensions[cl].width = col_widths[col]

# 数据格式:仅小文件(<1万行)逐格恢复
if ws.max_row <= 10000 and data_formats:
    for row in range(HEADER_ROW + 1, ws.max_row + 1):
        for col in range(1, ws.max_column + 1):
            if col in data_formats:
                df2 = data_formats[col]
                c = ws.cell(row=row, column=col)
                c.font, c.alignment, c.fill = df2['font'], df2['alignment'], df2['fill']

if freeze: ws.freeze_panes = freeze
wb.save(FILE)
print('完成')

Read the full file on GitHub · 182 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 182 lines · 114 tokens per session scan A ab96c6b6ef39

Subscribe to this mod's changes

excel-sort is a skill published in the GitHub repository YuYY2004/excel-skills (2 stars, last pushed 1mo ago), licensed MIT. It adds 114 tokens to every session and 1,898 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

spreadsheets

Use when creating, reading, or fixing spreadsheets (.xlsx, .csv). Covers formulas, formatting, charts, data cleaning, and handling the messy real-world files that are not actually tabular.

nimadorostkar/Claude-Skills-collection · 43 tokens

Excel工具

A guide for using Excel tools to read, write, and recalculate spreadsheet files. It includes a rule for treating the first row as data when a spreadsheet has no column headings.

XiaoMaColtAI/math-modeling-skill · 25 tokens

huashu-data-pro

All-in-one data analysis and productivity assistant. Covers end-to-end workflows for data processing, analytical insights, report writing, PPT creation, and data visualisation. Always approaches tasks from an expert perspective — thinks one step ahead for the user. Proactively confirms with the user when uncertain.…

Biraj2004/huashu-skills-english · 153 tokens

xlsx

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or…

lingxling/awesome-skills-cn · 201 tokens

thinkcell

Generate, update, and automate think-cell charts and elements in PowerPoint and Excel. Use ANY time the user mentions think-cell, thinkcell, or .ppttc files, or asks to create/update PowerPoint charts following think-cell conventions (waterfall, Mekko, stacked column, Gantt, Harvey ball, scatter/bubble, etc.) …

zmazz/thinkcell · 213 tokens

bug-report-writer

Converts rough notes, casual descriptions, console errors, or quick observations into professional, complete bug reports — exported as a formatted Excel (.xlsx) file ready for Excel, Google Sheets, Jira, or Azure DevOps. Use this skill whenever the user mentions: "write a bug report", "log a bug", "report this issue"…

ShreyasBh02/AI-Skills-Collection · 186 tokens