扩展 Google 幻灯片
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 Google Apps 脚本,您可以使用 Slides 服务以编程方式创建和修改 Google 幻灯片演示文稿。
您可以使用 Apps 脚本向 Google 幻灯片添加自定义菜单、对话框和边栏。您还可以将 Google 幻灯片与其他 Google 服务(例如 Google 日历、云端硬盘和 Gmail)集成。
开始使用
Apps 脚本包含一项内置服务,可让您以编程方式创建、读取和修改 Google 幻灯片。
Apps 脚本可以通过两种方式与 Google 幻灯片进行交互:
- 如果用户对某个演示文稿拥有适当的访问权限,则任何脚本都可以创建新演示文稿或访问现有演示文稿。
- 脚本可以绑定到演示文稿,这样脚本就可以更直接地访问该演示文稿的 Google 幻灯片界面。如需创建绑定脚本,请在 Google 幻灯片中依次选择扩展程序
> Apps 脚本。
自定义菜单和界面
您可以通过添加自定义菜单、对话框和边栏来自定义 Google 幻灯片。如需了解创建菜单的基础知识,请参阅菜单指南。如需了解如何自定义对话框的内容,请参阅 HTML 服务指南。
如果您打算将自定义界面作为插件的一部分发布,请遵循样式指南,以确保与 Google 幻灯片编辑器的样式和布局保持一致。
Google 幻灯片插件
插件是经过特殊封装的 Apps 脚本项目,可在 Google 幻灯片中运行,并且可以从 Google 幻灯片插件商店安装。如果您为 Google 幻灯片开发了脚本,并希望与全世界分享,那么通过 Apps 脚本,您可以将脚本发布为插件,以便其他用户可以从插件商店安装该插件。
如需查看 Google 幻灯片插件的示例,请参阅翻译插件示例或进度条插件示例。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eGoogle Apps Script enables programmatic creation and modification of Google Slides presentations.\u003c/p\u003e\n"],["\u003cp\u003eApps Script allows customization of Google Slides through custom menus, dialogs, and sidebars, and integration with other Google services.\u003c/p\u003e\n"],["\u003cp\u003eScripts can be bound to a presentation for direct access to the Slides user interface or used independently with appropriate permissions.\u003c/p\u003e\n"],["\u003cp\u003eApps Script projects can be packaged and published as add-ons, extending Google Slides functionality for other users.\u003c/p\u003e\n"]]],[],null,["# Extending Google Slides\n\nGoogle Apps Script lets you programmatically create and modify Google Slides\npresentations using the\n[Slides service](/apps-script/reference/slides/slides-app).\nYou can use Apps Script to add [custom menus](/apps-script/guides/menus),\n[dialogs, and sidebars](/apps-script/guides/dialogs) to Slides. You\ncan also integrate Slides with other\n[Google services](/apps-script/guides/services) like Calendar, Drive, and\nGmail.\n| **Note:** The [Slides service](/apps-script/reference/slides/slides-app) is the recommended way of working with Google Slides in Apps Script. You can also enable the [Slides advanced service](/apps-script/advanced/slides) if you need to invoke the [Slides API](/slides) directly.\n\nGet started\n-----------\n\nApps Script includes a\n[built-in service](/apps-script/reference/slides/slides-app)\nthat lets you programmatically create, read, and edit Google Slides.\nApps Script can interact with Google Slides in two ways:\n\n1. Any script can create a new presentation or access an existing presentation if the user has the appropriate access permissions for that presentation.\n2. A script can be [bound](/apps-script/guides/bound) to a presentation, which provides the script more direct access to the Slides user interface for that script. To create a bound script, select **Extensions** \\\u003e **Apps Script** from within Google Slides.\n\nCustom menus and user interfaces\n--------------------------------\n\nYou can customize Google Slides by adding custom menus, dialog boxes, and\nsidebars. To learn the basics of creating menus, see the\n[guide to menus](/apps-script/guides/menus). To learn about customizing the\ncontent of a dialog box, see the\n[guide to HTML service](/apps-script/guides/html#serve_html_as_a_google_docs_sheets_or_forms_user_interface).\n\nIf you're planning to publish your custom interface as part of an\n[add-on](#add-ons), follow the\n[style guide](/workspace/add-ons/guides/editor-style) for consistency with the\nstyle and layout of the Google Slides editor.\n\nadd-ons for Google Slides\n-------------------------\n\n[add-ons](/workspace/add-ons/overview) are specially packaged Apps Script\nprojects that run inside Google Slides and can be installed\nfrom the Google Slides add-on store. If you've developed a script for Google Slides and want to share it with the world, Apps Script lets you\n[publish](/workspace/add-ons/how-tos/editor-publish-overview) your script as an\nadd-on so other users can install it from the add-on store.\n\nSee the\n[sample translate add-on](/workspace/add-ons/editors/slides/quickstart/translate)\nor\n[sample progress bar add-on](/workspace/add-ons/editors/slides/quickstart/progress-bar)\nfor examples of Slides add-ons."]]