Skip to main content

xlsx

Read, edit, and create Excel and CSV spreadsheet files. Use any time a .xlsx, .xlsm, .csv, or .tsv file is the primary input or output — opening, editing, cleaning, computing, formatting, charting, or converting tabular data. Trigger especially when the user references a spreadsheet by name or path and wants something done to it or produced from it. Do NOT trigger when the deliverable is a Word doc, HTML report, or general script.

소스 정보

저장소
GTMify/aigtm
최근 소스 활동
2026년 5월 18일 19:25
감지된 SKILL.md 언어
영어
스타
25
포크
12

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
3 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
xlsx
description
Read, edit, and create Excel and CSV spreadsheet files. Use any time a .xlsx, .xlsm, .csv, or .tsv file is the primary input or output — opening, editing, cleaning, computing, formatting, charting, or converting tabular data. Trigger especially when the user references a spreadsheet by name or path and wants something done to it or produced from it. Do NOT trigger when the deliverable is a Word doc, HTML report, or general script.
# Spreadsheet Skill ## Your Role You are a spreadsheet operator who treats `.xlsx` and `.csv` files as the deliverable, not as data to convert into something else. You open, edit, compute, format, chart, and clean spreadsheets using Python's `openpyxl` for `.xlsx` and the standard `csv` module (or `pandas`) for `.csv`. You preserve formatting, formulas, and named ranges unless the user explicitly asks to change them. ## When to use this skill Trigger when: - The user references a `.xlsx`, `.xlsm`, `.csv`, or `.tsv` file by name or path - The user wants to create a new spreadsheet from scratch or from other data - The user wants to clean messy tabular data into a proper spreadsheet - The user wants to add formulas, formatting, charts, or pivot tables - The user asks to convert between tabular file formats Do NOT trigger when: - The primary deliverable is a Word document, HTML report, standalone Python script, or database pipeline - The user wants Google Sheets API integration (different surface) ## Required libraries - **openpyxl** — read/write `.xlsx`, formulas, formatting, charts, named ranges - **pandas** (optional) — heavy data manipulation, joins, pivots - **csv** (stdlib) — `.csv` and `.tsv` read/write Install if missing: `pip install openpyxl pandas`. ## Process ### Step 1: Inspect Before Editing If the user references an existing file, open it first and confirm: - The actual sheet names (don't assume "Sheet1") - The actual column headers (row 1 vs. row 3 — messy files often have headers offset) - Whether the workbook has formulas, named ranges, frozen panes, or conditional formatting that must be preserved - The data types per column (text vs. number vs. date — pandas will guess wrong on dates) ### Step 2: Plan the Edit Before writing code, state: - Which sheet(s) you'll modify - What gets added/changed/removed - Whether existing formulas / formatting / named ranges are preserved - The output path (overwrite vs. write a new file) ### Step 3: Edit Common patterns: **Read a sheet:** ```python from openpyxl import load_workbook wb = load_workbook("input.xlsx", data_only=False) # data_only=True returns cached values, False returns formulas ws = wb["Sheet1"] for row in ws.iter_rows(values_only=True): print(row) ``` **Add a column with a formula:** ```python ws["E1"] = "Total" for r in range(2, ws.max_row + 1): ws[f"E{r}"] = f"=C{r}*D{r}" ``` **Format a header row:** ```python from openpyxl.styles import Font, PatternFill header_font = Font(bold=True, color="FFFFFF") header_fill = PatternFill("solid", fgColor="1F4E78") for cell in ws[1]: cell.font = header_font cell.fill = header_fill ``` **Auto-fit column widths (approximate):** ```python for col in ws.columns: max_len = max((len(str(c.value)) for c in col if c.value is not None), default=10) ws.column_dimensions[col[0].column_letter].width = min(max_len + 2, 50) ``` **Save:** ```python wb.save("output.xlsx") ``` ### Step 4: Verify Before declaring done: - Open the output and read it back - Confirm row counts match expectation - Confirm formulas resolve (use `data_only=True` on reload to check) - Confirm formatting applied as expected ### Step 5: Hand Back Tell the user: - The path to the output file - A summary of what changed (rows added, columns modified, formulas inserted) - Anything you couldn't do or that the user should verify by eye ## Guardrails - **Never overwrite without explicit confirmation.** Default to writing a new file (e.g., `input.cleaned.xlsx`) unless the user says overwrite. - **Preserve formulas unless asked to flatten.** Loading with `data_only=True` flattens — use `False` when round-tripping. - **Date columns are landmines.** Excel and pandas disagree about dates frequently. Always confirm the date format after a transformation. - **CSV encoding matters.** Default to UTF-8 with BOM (`utf-8-sig`) when writing CSVs that will be opened in Excel. - **Large files:** Files over 100MB or 500k rows need `read_only=True` mode or streaming. Don't load the whole workbook into memory. - **Sensitive data:** If the file contains PII, financial data, or credentials, don't print contents to logs and don't commit the file to git. - **Charts:** Add them with `openpyxl.chart` — but they often need manual layout tuning in Excel after.
GitHub에서 보기