首頁 / Skills / 辦公與文件 / Excel 轉 Markdown
辦公與文件

Excel 轉 Markdown

awesome-copilot communityMITSkill 語言: 英文
授權已核對含腳本中風險
演示真實執行紀錄 · claude-sonnet-5-5 · 2026年10月
I have a workbook at .claude/skills/convert-excel-to-md/sales.xlsx with our Q3 sales. Please tell me the total revenue for each product, which region has a missing value, and the refunded units per region. The Python interpreter that has markitdown installed is /private/tmp/claude-501/-Users-huipeizhu-git-aibars-portal/1db8d52d-0133-4843-9915-dc2b4b4fafd0/scratchpad/mdtest/.venv/bin/python — use it by that exact path, and use relative paths for the script and the workbook.
Skill: convert-excel-to-md
Read: sales/sales.md

Revenue totals (from the Revenue column of the Q3 Sales sheet):

  • Widget: 1,900 (North 1,140 + South 760)
  • Gadget: 1,800 (East 1,080 + North 720). West's Gadget row has no revenue value, so it isn't included.

Missing value: West. The 2026-07-05 Gadget row has no Units and no Revenue. The unit price is 24.0, so the revenue can't be worked out without the units.

The sheet's own Total row shows 3,700 revenue and 275 units. That matches the sum of the rows that have values (1,900 + 1,800 = 3,700), so the total also leaves out West's missing sale.

Refunded units per region (Refunds sheet):

  • East: 3
  • North: 2
  • South and West: none listed, so presumably 0.

I converted the workbook to Markdown, and the output is in .claude/skills/convert-excel-to-md/sales/sales.md.

试用方式:Skill 的 Python 脚本需要 markitdown 包,我在隔离的临时环境里装好,并在提示词里给出解释器路径;Bash 只放行这条脚本命令。示例工作簿是我构造的(含一个有意留空的单元格和一张退款表)。模型的数字与我用代码复算的结果一致:Widget 1,900、Gadget 1,800、合计 3,700。

它做什麼

執行隨附的 Python 腳本(基於 MarkItDown),把 .xlsx 活頁簿轉成 Markdown 表格,讓模型能可靠地分析、摘要或擷取資料。活頁簿中的內嵌圖片會被擷取到 img/ 資料夾,每個工作表的小節連結到它的圖片。可處理單一檔案或一個資料夾中的多個活頁簿(可遞迴),輸出放在原始檔旁邊的 <名稱>/ 資料夾,或用 -o 指定的資料夾。

運作方式

  1. 依 references/setup.md 一次性完成環境準備(Python、pip 與 markitdown[xlsx])。
  2. 執行 python scripts/convert_excel_to_md.py <檔案或資料夾> [-o <輸出資料夾>] [--recursive]。
  3. 模型讀取產生的 <名稱>.md。

適合什麼場景

對一份試算表提問、從中擷取資料或做摘要。

說明與風險

中風險:它執行一個 Python 腳本,需要 `pip install` 安裝 `markitdown[xlsx]`;安裝說明中 Linux 的步驟會用到 `sudo apt-get install`,需要管理員權限。它會寫入 `<名稱>/<名稱>.md` 與 `img/` 資料夾,若目的地已有 `img/` 資料夾,會在擷取圖片前先把它刪除(只刪這個子資料夾),請選擇可以更動的輸出資料夾。Skill 的描述要求模型只要看到 `.xlsx` 就執行這個腳本,並同時呼叫處理 PDF 與 Word 的姊妹 Skill,而它們不在本站收錄範圍內。腳本不發出網路請求。已試用並發現一些限制:我在隔離的暫存環境中執行了腳本(含單檔、批次、遞迴加 -o、.xls 與不存在的路徑被拒絕),結果正確;但空白儲存格會顯示成 `NaN`(日期為 `NaT`),含空值的整數欄會顯示成 `120.0`;儲存格內容含 `|` 時不會跳脫,會錯位;從未以 Excel 開啟儲存過的檔案(如程式產生的),公式儲存格沒有快取值,會顯示 NaN;損毀的 .xlsx 不會回報失敗,而是把原始文字寫成 .md 並顯示成功。實測確認:`-o` 指向已有 `img/` 的資料夾時,其中檔案會被刪除。