獨立的指令碼
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
獨立指令碼是指未繫結至 Google 試算表、文件、簡報或表單檔案的任何指令碼。這些指令碼會顯示在 Google 雲端硬碟的檔案中。
建立獨立指令碼
如要建立獨立指令碼,最簡單的方式是前往 script.google.com
,然後按一下左上方的「新專案」add。
您也可以從 Google 雲端硬碟建立獨立指令碼。前往 Google 雲端硬碟,然後依序點選「新增」>「更多」>「Google Apps Script」。
執行獨立指令碼
如要從指令碼編輯器執行函式,請在頂端選取要執行的函式名稱,然後按一下「執行」。
使用獨立指令碼
許多獨立指令碼都是公用程式指令碼,例如在 Google 雲端硬碟中搜尋名稱含有「未命名」的舊檔案,以便刪除這些檔案。
獨立指令碼也可以部署為網頁應用程式,或設定為透過可安裝的觸發條件自動執行。
Apps Script 獨立指令碼適合為自己、團隊或機構開發輕量外掛程式。如果是較大型的專案,建議在其他執行階段環境中建構 Google Workspace 外掛程式。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eStandalone Google Apps Scripts are independent scripts not tied to any specific Google file like Sheets, Docs, or Slides, and they reside in your Google Drive.\u003c/p\u003e\n"],["\u003cp\u003eYou can effortlessly create a standalone script by visiting script.google.com or through Google Drive by navigating to New > More > Google Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eStandalone scripts are often utilized as utilities to automate tasks, such as searching and deleting files, or deployed as web apps or triggered automatically.\u003c/p\u003e\n"],["\u003cp\u003eThey can be run directly from the script editor by selecting the desired function and clicking Run.\u003c/p\u003e\n"],["\u003cp\u003eAdditionally, add-ons for Google Workspace can now be published using standalone scripts.\u003c/p\u003e\n"]]],[],null,["# Standalone Scripts\n\nA standalone script is any script that is not\n[bound to a Google Sheets, Docs, Slides, or\nForms file](/apps-script/guides/bound). These scripts appear\namong your files\nin Google Drive.\n\nCreating a standalone script\n----------------------------\n\nThe easiest way to create a standalone script is to visit\n[`script.google.com`](https://script.google.com)\nand at the top left, click add**New project**.\n\nYou can also create standalone scripts from Google Drive. Go to [Google Drive](https://drive.google.com)\nand click **New \\\u003e More \\\u003e Google Apps Script**.\n\nRunning a standalone script\n---------------------------\n\nTo run a function from the script editor, at the top, select the name\nof the function you want to execute and click **Run**.\n\nUsing a standalone script\n-------------------------\n\nMany standalone scripts are utility scripts --- for example, to\n[search your Google Drive for old files whose name contains \"untitled\"](/apps-script/reference/drive/drive-app#searchFiles(String))\nso that you can delete them.\n\nA standalone script can also be deployed as a [web app](/apps-script/guides/web)\nor set up to run automatically from an\n[installable trigger](/apps-script/guides/triggers/installable).\n\nApps Script standalone scripts are suitable for lightweight\nadd-on development for yourself, your team, or your\norganization. For larger projects, consider building a Google Workspace\nadd-on on a [different runtime](/workspace/add-ons/guides/alternate-runtimes)\nenvironment."]]