首頁 / Skills / 辦公與文件 / Excel 活頁簿產生 Excel Workbook Builder
辦公與文件

Excel 活頁簿產生 Excel Workbook Builder

AIBarsMITSkill 語言: 英文
授權已核對不含腳本中風險
演示真實執行紀錄 · claude-sonnet-5-5 · 2026年10月
Build me an Excel workbook called budget.xlsx for a simple monthly household budget. Put the assumptions (monthly income and a few fixed amounts such as rent, food, transport, savings goal percentage) on an Inputs sheet, and on a Budget sheet list the categories with amounts as formulas that refer to the inputs, a total spent, the remaining amount and a savings check. Add a bar chart of spending by category. Use sample numbers and label them as sample. Then tell me what you verified.
Skill: excel-workbook-builder

I've built budget.xlsx, but I haven't recalculated it. LibreOffice isn't installed here, so Excel will calculate the formulas when you open the file. The script that generates it is build_xlsx.py, in the same folder.

What's in it

  • Inputs sheet: the assumptions are in yellow cells and labelled "Sample". They are monthly income 4,500, rent 1,400, food 600, transport 250, utilities 200 and a savings goal of 15%.
  • Budget sheet:
    • Categories: rent, food, transport and utilities. Each amount is a formula pointing at the Inputs sheet (for example =Inputs!B5), and each has a "% of income" column.
    • Totals: a total spent row (=SUM(B4:B7)), income, and the remaining amount (income minus total spent).
    • Savings check: it compares the remaining amount with income × savings goal %. It shows "On track - surplus of …" or "Short by …".
  • Chart: a bar chart of spending by category, titled as sample, next to the table.

What I checked

  • I reopened the saved file and confirmed there are two sheets, one chart, and no hard-coded numbers on the Budget sheet. Every amount and total is a formula.
  • I read each formula's cell references by hand and they point at the right inputs.
  • Working it out by hand with the sample numbers, total spent is 2,450, remaining is 2,050, and the savings goal is 675. The check should therefore read "On track - surplus of 1,375.00".

Not checked

  • No recalculation, so I haven't seen the computed values or confirmed the chart renders correctly.
  • If a number looks off when you open it, tell me.

Your call: the savings goal isn't counted as a spending category. It's only compared against what's left over. I can add it as a category if you'd rather see it in the total and the chart.

Test run: a sample household budget built with openpyxl in a temporary folder. The run was allowed to write files and run python3 only. The formulas were inspected by re-opening the file and by hand calculation, but not recalculated, because LibreOffice was not installed. Excel calculates them on opening. All numbers are sample.

它做什麼

撰寫並執行一個 Python 腳本來建立或修改活頁簿,讓它像真正的試算表那樣運作。計算用公式,參照有標籤的輸入表或具名範圍,而不是把數字埋在公式裡或貼成數值。它會設定表頭格式、數字格式、欄寬、凍結窗格、資料驗證、條件式格式與圖表。修改既有檔案時,先列出工作表、公式與具名範圍,只改你要求的儲存格,提醒 openpyxl 儲存時可能遺失的內容(樞紐分析表、交叉分析篩選器、部分格式),並另存為新檔名。它也能檢查一張表裡的錯誤值、存成文字的數字、公式裡寫死的數字,以及沒涵蓋全部資料的範圍。openpyxl 不能重新計算,所以它會說明公式是重新計算過,還是只檢查過。

輸出

.xlsx 檔案、腳本、說明哪些算過哪些沒算的核對報告,以及需要你確認的假設。

適合什麼場景

依資料產生或修復預算、追蹤表、報表活頁簿,以及快速檢查一張出現錯誤的表格。

說明與風險

中風險:純指令檔,本身沒有腳本,但它會撰寫並執行 Python,在你的工作目錄建立檔案,也可能建議在虛擬環境安裝 openpyxl。它不會覆蓋你的原檔案,不建立巨集,也不加入外部連結。已在暫存資料夾用範例數字試用一次:產生了一個含公式與圖表的兩表預算;公式經過檢查與手算核對,但因為沒裝 LibreOffice 沒有重新計算,Excel 開啟時會計算。不要把它用作財務或稅務決策的依據。AIBars 原創(MIT)。

SKILL.md 原文套件內共 2 個檔案