xlsx
하는 일
이 스킬은 AI 에이전트에게 Excel 파일과 대량의 CSV, TSV 표를 다루는 방법을 알려 줍니다. 스프레드시트를 만들고, 고치고, 분석해야 하는 사람에게 맞습니다.
사용하는 경우
- ✓Excel이나 CSV 파일을 올려 데이터를 분석하거나 정리하고 싶을 때.
- ✓수식, 서식, 차트를 갖춘 새 스프레드시트가 필요할 때.
- ✓어수선한 표를 쓸 수 있는 깔끔한 스프레드시트로 다시 구성하고 싶을 때.
스킬 링크
https://github.com/HKUDS/DeepTutor/blob/main/deeptutor/skills/builtin/xlsx/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 스프레드시트를 정리하고, 월별 합계 열을 추가해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 Python 라이브러리로 데이터, 수식, 스타일, 차트를 통합 문서에 씁니다. 저장한 뒤 파일을 다시 열어 점검합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Excel (.xlsx) workbooks
Runtime
Use exec with complete Python source (language: python). Prefer creating,
saving, reopening, and validating the workbook in one call; later calls can
revise the same relative filename. Follow the turn's User workspace
instructions for locating inputs, output boundaries, and presenting the
finished file.
Use openpyxl for cells, formulas, styles, charts, merged cells, multi-sheet workbooks, number formats, and streaming large sheets. It is declared by every supported DeepTutor installation. Do not assume pandas is installed: it exists in the Docker runner but is not a direct dependency of every pip/source install.
THE critical gotcha: openpyxl writes formulas but never computes them
ws["B10"] = "=SUM(B2:B9)" stores the formula string. openpyxl has no formula
engine — the cached value stays empty (or stale, on an edited file). So:
- A workbook you create/edit with openpyxl opens fine in Excel/LibreOffice (they recompute on open), but its cached values are wrong until then.
- Anything reading cached values first —
data_only=True, another pandas/openpyxl pass, or a downstream tool — sees blanks/stale data.
Pick by what the deliverable needs:
- Static numbers (most common). If the user just needs correct values and
the sheet need not stay live, compute in Python and write the number, not
a formula string:
ws["B10"] = sum(c.value for c in ws["B2:B9"][0]). Correct immediately, no recalc needed. - Live model (formulas that recompute on the user's later edits). Write real
formulas, and reference cells not literals (
=B5*(1+$B$6), not=B5*1.05). openpyxl can't set the cached value too. Ifshutil.which("soffice")succeeds, recalculate throughexecusingsubprocess.runand a relative_recalc/directory, replaceout.xlsxwith the recalculated copy, then remove_recalc/. Never use/tmpor search for a desktop installation. A later exec call can see the same bare filename. If LibreOffice is absent, warn that formulas populate when the user opens the file in Excel.
Reading
from openpyxl import load_workbook
wb = load_workbook("in.xlsx", read_only=True, data_only=False)
for sheet_name in wb.sheetnames:
ws = wb[sheet_name]
for row in ws.iter_rows(values_only=True):
print(row)
To read computed results of formulas (not the formula text), use openpyxl
with data_only=True — returns the value Excel last cached:
from openpyxl import load_workbook
wb = load_workbook("in.xlsx", data_only=True)
val = wb["Sheet1"]["B10"].value # None if Excel never opened/saved the file
Gotcha: never save() a workbook loaded with data_only=True — that discards
every formula permanently (verified: the cell becomes None). Load twice if you
need both formulas and values.
Large file: load_workbook(path, read_only=True) streams rows cheaply.
Creating
from openpyxl import Workbook, load_workbook
from openpyxl.styles import Font, PatternFill, Alignment
wb = Workbook()
ws = wb.active
ws.title = "Summary"
ws.append(["Region", "Sales"]) # header row
for r in [("West", 120), ("East", 95)]:
ws.append(r)
ws["B4"] = "=SUM(B2:B3)" # see formula gotcha above
ws["A1"].font = Font(bold=True)
ws["A1"].fill = PatternFill("solid", fgColor="DDDDDD")
ws["A1"].alignment = Alignment(horizontal="center")
ws["B2"].number_format = "#,##0" # thousands separator
ws.column_dimensions["A"].width = 18
ws.freeze_panes = "A2" # freeze header
wb.create_sheet("Detail") # second sheet
wb.save("out.xlsx")
# Validate immediately; later exec calls can also reopen this relative path.
check = load_workbook("out.xlsx", data_only=False)
assert check.sheetnames, "generated workbook has no worksheets"
import zipfile
with zipfile.ZipFile("out.xlsx") as package:
assert package.testzip() is None, "generated XLSX has a corrupt ZIP member"
For large exports, use openpyxl's write-only mode and append rows without holding every cell object in memory:
from openpyxl import Workbook
wb = Workbook(write_only=True)
ws = wb.create_sheet("Data")
ws.append(["id", "value"])
for row in rows:
ws.append(row)
wb.save("out.xlsx")
Editing (preserve existing formatting)
load_workbook keeps styles, formulas, merged cells, charts intact — edit only
what you touch. Do NOT round-trip through pandas to preserve formatting (pandas
rewrites the whole sheet, losing styles).
``
자주 묻는 질문
수식을 다룰 수 있나요?
네. 수식을 쓸 수 있지만, 일부 값은 Excel이나 다른 스프레드시트 앱에서 파일을 열 때에야 업데이트될 수 있습니다.
차트를 만들 수 있나요?
네. 병합된 셀, 숫자 서식, 여러 시트가 있는 통합 문서도 다룹니다.
CSV 파일도 다루나요?
네. Excel 파일뿐 아니라 대량 CSV와 TSV 표도 다룹니다.
상세 정보
작성자의 원본 설명
Read, create, or edit Excel spreadsheets (.xlsx/.xlsm) — sheet data, formulas, styles, charts, multi-sheet workbooks — and bulk .csv/.tsv tables; use whenever a spreadsheet is the input or the deliverable (extract/analyze data, add columns/formulas/formatting/charts, clean messy tables, build from scratch), but not for Google Sheets API or Word/PDF/script outputs.
repo: HKUDS/DeepTutor
인기도
- GitHub 스타
- 54k
- 순위
- #3372
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 10. 31.
댓글
- …
이 저장소의 다른 스킬
deeptutor-cli
54k에이전트가 학습 플랫폼 DeepTutor를 명령줄에서 설정하고 실행하도록 돕습니다. 지식 베이스, 노트북, 웹 앱을 포함합니다.
docx
54k에이전트가 Word .docx 파일을 읽고, 만들고, 고치도록 돕습니다. 보고서, 표, 찾아 바꾸기, 댓글이 달린 변경 추적을 포함합니다.
에이전트가 PDF 파일을 읽고, 병합하고, 나누고, 양식을 채우고, 새로 만들도록 돕습니다. 텍스트와 표를 뽑아내는 작업도 포함합니다.
pptx
54k에이전트가 PowerPoint 슬라이드 덱을 만들고 읽고 고치도록 돕습니다. 슬라이드 텍스트, 발표자 노트, 차트, 이미지를 포함합니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.