独立脚本
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
独立脚本是指未绑定到 Google 表格、文档、幻灯片或表单文件的任何脚本。这些脚本会显示在 Google 云端硬盘的文件中。
创建独立脚本
创建独立脚本的最简单方法是访问 script.google.com
,然后点击左上角的 add新项目。
您还可以通过 Google 云端硬盘创建独立脚本。前往 Google 云端硬盘,然后依次点击“新建”>“更多”>“Google Apps 脚本”。
运行独立脚本
如需从脚本编辑器中运行函数,请在顶部选择要执行的函数的名称,然后点击运行。
使用独立脚本
许多独立脚本都是实用脚本,例如,在 Google 云端硬盘中搜索名称包含“未命名”的旧文件,以便您可以将其删除。
独立脚本也可以部署为网络应用,或者设置为通过可安装的触发器自动运行。
Apps 脚本独立脚本非常适合为自己、团队或组织开发轻量级插件。对于较大的项目,请考虑在其他运行时环境中构建 Google Workspace 加载项。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):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."]]