export-excellisted
Install: claude install-skill CloudyWing/ai-dotfiles
# Excel 試算表匯出技能
## 觸發條件
使用者提到 Excel 相關的建立、匯出、產生、製作需求時,執行本 Skill。常見觸發語句包含但不限於:
- 「幫我建立 / 產生 / 製作 / 匯出 xxx Excel」
- 明確說「使用 export-excel」
## 執行流程
1. **分析需求** — 從使用者描述中確認:工作表數量、欄位清單、是否需要靜態標題列(Grid)、資料來源格式、輸出路徑、是否需要資料驗證或共用樣式。
2. **產生 JSON** — 依下方格式規範產生 JSON 內容,寫入暫存檔(例如工作目錄下的 `spreadsheet.json`)。
3. **執行腳本** — 呼叫 `export-excel.csx` 並傳入 JSON 檔路徑與輸出路徑。
4. **回報結果** — 告知使用者輸出檔路徑與工作表摘要。
### 執行指令
```bash
dotnet script export-excel.csx <json-or-json-file> <output-path>
```
- `json-or-json-file`:JSON 字串、副檔名 `.json` 的檔案路徑,或 `-` 表示由 stdin 讀取(建議使用檔案,避免 shell 跳脫問題)。
- `output-path`:輸出的 `.xlsx` 路徑。
---
## JSON 根結構
根層級為工作表陣列,每個工作表可包含 Styles 與 Templates:
```json
[
{
"SheetName": "Sheet1",
"DefaultRowHeight": 20,
"Password": "sheet-pass",
"FreezePanes": { "Row": 1, "Column": 0 },
"IsAutoFilterEnabled": true,
"ColumnWidths": [
{ "Index": 0, "Width": 18 },
{ "Index": 1, "Width": 24 }
],
"PageSettings": {
"PageOrientation": "Portrait",
"PaperSize": "A4"
},
"Metadata": { "reportType": "monthly" },
"Styles": {
"Header": { "HasBorder": true, "Font": { "Style": "Bold" } }
},
"Templates": [ ]
}
]
```
### 工作表層級欄位
| 欄位 | 型別 | 說明 |
| --- | --- | --- |
| `SheetName` | string | 工作表名稱,省略時自動命名 |
| `DefaultRowHeight` | number | 預設列高 |
| `Password` | string | 工作表保護密碼,配合 `Style.IsLocked` 控制鎖定範圍 |
| `FreezePanes` | object | 凍結 `Row` 列與 `Column` 欄,例:`{ "Row": 1, "Column": 0 }` |
| `IsAutoFilterEnabled` | boolean | 啟用自動