Chuyển đến nội dung
Skillpedia
PDF, Word và slide7.1k · #13595

xlsx

Skill này làm gì

Skill này dạy agent cách làm việc với file Microsoft Excel. Nội dung gồm đọc các trang tính hiện có, chỉnh sửa cẩn thận để giữ nguyên phần còn lại của file, và tạo workbook mới từ danh sách các hàng.

Khi nào nên dùng

  • ✓Khi bạn muốn agent tìm hoặc tóm tắt dữ liệu trong một file Excel.
  • ✓Khi bạn cần cập nhật các ô cụ thể trong một bảng tính có sẵn mà không làm hỏng nó.
  • ✓Khi bạn muốn tạo một workbook Excel mới từ bảng các hàng hoặc ghi chú.

Liên kết skill

https://github.com/TokenRhythm/opensquilla/blob/main/src/opensquilla/skills/bundled/xlsx/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/TokenRhythm/opensquilla/blob/main/src/opensquilla/skills/bundled/xlsx/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi có một bảng tính bán hàng và cần sửa tổng ở cột F mà không làm mất định dạng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent làm việc trực tiếp trên các ô của file và coi số, văn bản, ngày tháng và công thức là các loại giá trị riêng biệt. Nó dùng một công cụ Python để đọc hoặc ghi workbook, rồi trả về file đã hoàn thành.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

xlsx

Work with .xlsx workbooks. The format is OOXML SpreadsheetML — a zip container of XML parts. Treat each cell as a typed value: a number, a string, a datetime, or a formula. Mixing the four causes Excel to flag the workbook or compute incorrect totals.

Decide the path first

You have Goal Path
Existing .xlsx Read sheets and cells A. Inspect
Existing .xlsx Modify specific cells B. Edit-in-place
Nothing or a brief Build a new workbook C. Create from scratch

If the user provides a workbook to update, default to path B and treat the input as the formatting baseline. Choose path C only when the user says "start fresh".

Execution and delivery

Use execute_code with the Python examples below when it is available. Keep all input and output files in the active workspace, then call publish_artifact(path="out.xlsx") to deliver the finished workbook. In a restricted channel, use openpyxl directly; the shell commands below are optional shortcuts for sessions that expose exec_command. Do not use Python subprocesses to bypass an unavailable shell tool or request host execution when the sandbox fails. If execution or a required library is unavailable, report that limitation and keep the session read-only.


Path A: Inspect

With execute_code:

from openpyxl import load_workbook
wb = load_workbook("book.xlsx", data_only=False)
for ws in wb.worksheets:
    print(ws.title, list(ws.values))
wb.close()
python {baseDir}/scripts/inspect_xlsx.py /path/to/book.xlsx

Output:

{
  "sheets": [
    {
      "name": "Q3",
      "max_row": 10,
      "max_col": 5,
      "rows": [
        [
          {"value": "Metric", "type": "s"},
          {"value": "Value", "type": "s"}
        ],
        [
          {"value": "Revenue", "type": "s"},
          {"value": 2100000, "type": "n"}
        ]
      ]
    }
  ]
}

type follows openpyxl conventions: n (number), s (string), d (datetime), f (formula), b (bool), e (error), inlineStr (inline string). The helper script reads with data_only=False so formula expressions are returned literally; pass --data-only to get the cached computed result instead.


Path B: Edit in place

With execute_code:

from openpyxl import load_workbook
wb = load_workbook("book.xlsx")
wb["Q3"]["B2"] = "=SUM(B3:B10)"
wb.save("edited.xlsx")
wb.close()
python {baseDir}/scripts/edit_xlsx.py book.xlsx ops.json --out edited.xlsx

ops.json:

[
  {"op": "set_cell", "sheet": "Q3", "row": 2, "col": 2, "value": "=SUM(B3:B10)"},
  {"op": "set_cell", "sheet": "Q3", "row": 5, "col": 1, "value": "Net margin"},
  {"op": "rename_sheet", "old": "Sheet1", "new": "Summary"}
]

Rules:

  • Rows and columns are 1-based (Excel convention).
  • Strings starting with = are written as formulas (cell.value = "=..."), matching openpyxl behavior. To write a literal =hello use '=hello (Excel's leading-apostrophe escape) or pass an explicit as_text: true.
  • Datetimes go in as ISO 8601 strings ("2026-05-06T09:00:00"); the helper parses them back to datetime objects so Excel renders the cell with date format.
  • Editing a cell does not recalculate dependent formulas. Excel and LibreOffice recalculate on open. If you need cached values immediately, use a calculation engine (out of scope here).

Path C: Create from scratch

python {baseDir}/scripts/create_xlsx.py spec.json --out out.xlsx

Spec:

{
  "sheets": [
    {
      "name": "Sales",
      "rows": [
        ["Region", "Revenue", "Growth"],
        ["NA", 1200000, "=B2/SUM($B$2:$B$4)"],
        ["EU", 850000, "=B3/SUM($B$2:$B$4)"]
      ],
      "merged": [{"range": "A1:C1"}],
      "freeze": "A2"
    }
  ]
}

For programmatic use:

from openpyxl import Workbook
wb = Workbook()
ws = wb.active
ws.title = "Sales"
ws.append(["Region", "Revenue"])
ws.append(["NA", 1_200_000])
ws["C2"] = "=B2*1.05"          # formula
ws.merge_cells("A1:B1")
ws.freeze_panes = "A2"
wb.save("out.xlsx")

See references/openpyxl.md for styles, conditional formatting, charts, and formula references.


Common pitfalls

Symptom Cause Fix
Cell shows =SUM(...) as text, not the result Wrote the string with as_text: true or workbook lacks cached values Open in Excel and save once; or use a calc engine
Date renders as a ser
Câu hỏi thường gặp

Agent có giữ định dạng hiện có khi chỉnh sửa file không?

Có. Với workbook có sẵn, skill dùng file của bạn làm chuẩn định dạng và chỉ thay đổi các ô bạn yêu cầu.

Agent có luôn bắt đầu workbook mới từ đầu không?

Không. Nó chỉ bắt đầu lại khi bạn yêu cầu. Nếu không, nó chỉnh sửa file bạn đưa.

Nếu agent không chạy được công cụ Python thì sao?

Skill yêu cầu báo cáo giới hạn và giữ phiên ở chế độ chỉ đọc, thay vì tìm cách vòng qua.

Chi tiết

Mô tả gốc của tác giả

Read, inspect, edit, or create Microsoft Excel `.xlsx` workbooks, including structured data extraction, formula-aware cell edits, and workbook generation from rows.

repo: TokenRhythm/opensquilla

Độ phổ biến

Sao GitHub
7.1k
Vị trí xếp hạng
#13595
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự