試算表巨集資訊清單資源
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
用來定義
Google 試算表巨集的設定。定義巨集的資訊清單必須包含所有標示為「必填」的欄位。
試算表
這是 Google 試算表巨集資訊清單設定的頂層。這項函式僅用於定義 Google 試算表巨集。
JSON 表示法 |
{
"macros": [
{
object (Macro)
}
]
} |
欄位 |
macros[] |
object (Macro)
必要。已定義巨集及其相關聯屬性的清單。
|
巨集
單一巨集的設定。定義必須包含所有標示為「必填」的欄位。
JSON 表示法 |
{
"defaultShortcut": string,
"functionName": string,
"menuName": string
} |
欄位 |
defaultShortcut |
string
定義執行巨集的鍵盤快速鍵。
這必須採用 Ctrl+Alt+Shift+Number 格式,
其中 Number 為單一數字。如果巨集沒有捷徑,就只能從「工具」>「巨集」選單執行。
|
functionName |
string
必要。執行巨集的 Apps Script 函式名稱。根據預設,這會與自動建立的函式相符,但這並非必要條件。menuName |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eSheets macros are defined using a manifest configuration, which must include all required fields.\u003c/p\u003e\n"],["\u003cp\u003eEach macro definition specifies a keyboard shortcut, the name of the Apps Script function to execute, and the menu name displayed in the Google Sheets UI.\u003c/p\u003e\n"],["\u003cp\u003eThe keyboard shortcut must be unique and follow the format \u003ccode\u003eCtrl+Alt+Shift+\u003c/code\u003e followed by a single digit.\u003c/p\u003e\n"],["\u003cp\u003eMacros without assigned shortcuts can only be run from the \u003cstrong\u003eTools > Macros\u003c/strong\u003e menu in Google Sheets.\u003c/p\u003e\n"]]],[],null,["# Sheets macro manifest resource\n\nThe configuration that is used to define\n[Sheets macros](/apps-script/guides/sheets/macros#manifest_structure_for_macros). Manifests that define macros must have all the fields\nmarked as **Required**.\n\nSheets\n------\n\nThe top-level of the Sheets macro manifest configuration. This is only\nused to define Sheets macros.\n\n| JSON representation |\n|--------------------------------------------------|\n| ```text { \"macros\": [ { object (Macro) } ] } ``` |\n\n| Fields ||\n|------------|------------------------------------------------------------------------------------------------------|\n| `macros[]` | `object (`[Macro](#macro)`)` **Required.** A list of defined macros and their associated properties. |\n\n### Macro\n\nThe configuration for a single macro. The definition must have all the fields\nmarked as **Required**.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------|\n| ```text { \"defaultShortcut\": string, \"functionName\": string, \"menuName\": string } ``` |\n\n| Fields ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `defaultShortcut` | `string` Defines the keyboard shortcut that executes the macro. This **must** be of the form `Ctrl+Alt+Shift+`*Number*, where *Number* is a single-digit. Macros without shortcuts can only be executed from the **Tools \\\u003e Macros** menu. | **Warning**: the keyboard shortcut used by each defined macro must be unique. |\n| `functionName` | `string` **Required.** The name of the Apps Script function that executes the macro. By default this matches the `menuName` for functions automatically created, but this is not a requirement. |\n| `menuName` | `string` **Required.** The name of the macro as it appears in the Google Sheets UI. |"]]