範例
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本節提供一系列範例應用程式和「做法」範例,說明如何將預期的 Google 簡報動作轉換為 Google 簡報 API 要求。
程式碼研究室

簡報 Codelab 說明如何使用 Google 簡報 API,做為最常見軟體授權分析的自訂簡報工具。
您將瞭解如何使用 BigQuery 查詢 GitHub 上的所有開放原始碼,以及如何使用 Slides API 建立投影片組來呈現結果。
應用程式範例

Markdown to Slides 指令列工具可讓您從 Markdown 檔案產生投影片組。
您可以藉此探索 Slides API,或分叉存放區並修改程式碼,為 JavaScript 應用程式提供 Slides 輸出內容。
食譜
本節列出的範例會示範如何以 Slides API 要求表示 Google 簡報中的常見動作。
這些範例以 HTTP 要求的形式呈現,因此不限語言。如要瞭解如何使用 Google API 用戶端程式庫,以特定語言實作 Slides API 要求通訊協定,請參閱下列指南:
本節的食譜分為下列類別:
- 基本讀取:顯示從簡報讀取資訊的常見方式。
- 基本寫法:顯示常見的簡報寫法。
- 元素作業:顯示常見網頁元素建立和編輯工作的配方。
- 簡報作業:說明如何建立及操控簡報的食譜。
- 投影片操作:食譜,說明如何在簡報中建立、移動及刪除投影片。
- 表格作業:食譜,說明如何在投影片中建立及編輯表格。
- 轉換作業:食譜,說明如何變更投影片中元素的大小和位置。
使用 Google 簡報 API 完成特定工作時,通常不只一種方法。盡可能使用批次方法 presentations.batchUpdate
,將多個更新要求綁定至單一方法呼叫。這項功能可減少用戶端 HTTP 負擔、查詢次數,並將簡報修訂次數降到最低,同時以不可分割的形式套用所有變更。
如要進一步提升效能,請在讀取及更新簡報、頁面和頁面元素時,使用欄位遮罩。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],null,["# Samples\n\nThis section presents a set of sample applications and \"recipe\" examples that\ndemonstrate how to translate an intended Google Slides action into an\nGoogle Slides API request.\n\nCodelabs\n--------\n\nThe [Slides\ncodelab](https://codelabs.developers.google.com/codelabs/slides-api)\nteaches you how to use Google Slides API as a custom presentation tool for an\nanalysis of the most common software licenses.\n\nYou'll learn how to query all open source code on GitHub using [BigQuery](https://cloud.google.com/bigquery) and create a\nslide deck using Slides API to present your results.\n\nSample applications\n-------------------\n\nThe [Markdown to\nSlides](https://github.com/googleworkspace/md2googleslides)\ncommand-line tool lets you generate slide decks from markdown files.\n\nYou can use this to explore the Slides API, or fork the repository and\nmodify the code to provide Slides output to your JavaScript\napplication.\n\nRecipes\n-------\n\nThe examples listed in this section demonstrate how to express common actions in\nSlides as Slides API requests.\n\nThese examples are presented as HTTP requests to be language neutral. To learn\nhow to implement Slides API request protocols in a specific language\nusing Google API client libraries, see the following guides:\n\n- [Create a slide](/workspace/slides/api/guides/create-slide)\n- [Add shapes and text](/workspace/slides/api/guides/add-shape)\n- [Merge data into a presentation](/workspace/slides/api/guides/merge)\n- [Add charts to a slide](/workspace/slides/api/guides/add-chart)\n- [Edit and style text](/workspace/slides/api/guides/styling)\n\nRecipes in this section are divided into the following categories:\n\n- [Basic reading](/workspace/slides/api/samples/reading)---Recipes that show common ways of reading information from a presentation.\n- [Basic writing](/workspace/slides/api/samples/writing)---Recipes that show common ways of writing to a presentation.\n- [Element operations](/workspace/slides/api/samples/elements)---Recipes that show common page element creation and editing tasks.\n- [Presentation operations](/workspace/slides/api/samples/presentation)---Recipes that show how to create and manipulate a presentation.\n- [Slide operations](/workspace/slides/api/samples/slides)---Recipes that show how to create, move, and delete slides in a presentation.\n- [Table operations](/workspace/slides/api/samples/tables)---Recipes that show how to create and edit tables within a slide.\n- [Transform operations](/workspace/slides/api/samples/transform)---Recipes that show how to alter the size and positioning of elements within a slide.\n\nThere's often more than one way to complete a given task with the\nSlides API. Use the batch method\n[`presentations.batchUpdate`](/workspace/slides/api/reference/rest/v1/presentations/batchUpdate)\nwherever possible to bundle multiple update requests into a single method call.\nThis reduces client HTTP overhead, reduces the number of queries, minimizes the\nnumber of revisions on the presentation, and applies all the changes atomically.\n\nTo further improve performance, use [field\nmasks](/workspace/slides/api/guides/field-masks) when reading and updating presentations,\npages, and page elements."]]