Google Slides API ช่วยให้คุณอ่านข้อมูลงานนำเสนอ หน้า และองค์ประกอบของหน้าได้ ตัวอย่างในหน้านี้แสดงวิธีดำเนินการอ่านที่พบบ่อยโดยใช้ทั้งเมธอด presentations.get และ presentations.pages.get
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-08-04 UTC"],[],[],null,["The Google Slides API lets you read presentation, page, and page element data. The\nexamples on this page show how to perform common read operations using both the\n[`presentations.get`](/workspace/slides/api/reference/rest/v1/presentations/get) and\n[`presentations.pages.get`](/workspace/slides/api/reference/rest/v1/presentations.pages/get)\nmethods.\n\nThese examples use the following placeholders:\n\n- \u003cvar translate=\"no\"\u003ePRESENTATION_ID\u003c/var\u003e---Indicates where you provide the [presentation\n ID](/workspace/slides/api/guides/overview#the_structure_of_a_presentation). You can discover the value for this ID from the presentation URL.\n- \u003cvar translate=\"no\"\u003ePAGE_ID\u003c/var\u003e---Indicates where you provide the [page object\n ID](/workspace/slides/api/guides/overview#working_with_object_ids). You can retrieve the value for this from the URL or by using an API read request.\n\nThese examples are presented as HTTP requests to be language neutral. The\nexamples read from this [example\npresentation](https://docs.google.com/presentation/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/edit),\nthat has `1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc` as its\n\u003cvar translate=\"no\"\u003ePRESENTATION_ID\u003c/var\u003e. The \u003cvar translate=\"no\"\u003ePAGE_ID\u003c/var\u003e of the\n[first\nslide](https://docs.google.com/presentation/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/edit#slide=id.ge63a4b4_1_0)\nin this presentation is `ge63a4b4_1_0`.\n\nThe examples here use [field masks](/workspace/slides/api/guides/field-masks) to only\nreturn specific requested information about the presentation, slide, and page\nelement. Using field masks also improves performance.\n\nRead slide object IDs\n\nThe following\n[`presentations.get`](/workspace/slides/api/reference/rest/v1/presentations/get) code\nsample shows how to retrieve a list of all the slide object IDs from the\npresentation. The IDs are returned in the slide presentation order, and can be\nused to indicate specific slides in subsequent API requests. You can get the\nobject IDs of master and layout pages the same way, using\n`fields=masters.objectId` and `fields=layout.objectId`.\n\nThe following is the request protocol to read slide object IDs:\n\n\u003cbr /\u003e\n\n```\nGET https://slides.googleapis.com/v1/presentations/PRESENTATION_ID?fields=slides.objectId\n```\n\nThe response consists of a\n[`Presentation`](/workspace/slides/api/reference/rest/v1/presentations#resource:-presentation)\nobject containing the object IDs requested: \n\n```scdoc\n{\n \"slides\": [\n {\n \"objectId\": \"ge63a4b4_1_0\"\n },\n {\n \"objectId\": \"ge63a4b4_1_9\"\n },\n {\n \"objectId\": \"ge63a4b4_1_23\"\n },\n {\n \"objectId\": \"ge63a4b4_1_35\"\n },\n {\n \"objectId\": \"ge63a4b4_1_43\"\n }\n ]\n}\n```\n\nRead element object IDs from a page\n\nThe following\n[`presentations.pages.get`](/workspace/slides/api/reference/rest/v1/presentations.pages/get)\ncode sample shows how to retrieve a list of object IDs for all the page elements\non a page.\n\nThe following is the request protocol to read element object IDs from a page:\n\n\u003cbr /\u003e\n\n```\nGET https://slides.googleapis.com/v1/presentations/PRESENTATION_ID/pages/PAGE_ID?fields=pageElements.objectId\n```\n\nThe response consists of a\n[`Page`](/workspace/slides/api/reference/rest/v1/presentations.pages#resource-page) object\ncontaining the object IDs requested: \n\n```scdoc\n{\n \"pageElements\": [\n {\n \"objectId\": \"ge63a4b4_1_5\"\n },\n {\n \"objectId\": \"ge63a4b4_1_6\"\n },\n {\n \"objectId\": \"ge63a4b4_1_7\"\n },\n {\n \"objectId\": \"ge63a4b4_1_8\"\n }\n ]\n}\n```\n\nRead shape elements from a page\n\nThe following\n[`presentations.pages.get`](/workspace/slides/api/reference/rest/v1/presentations.pages/get)\ncode sample shows how to retrieve a list of all\n[`Shapes`](/workspace/slides/api/reference/rest/v1/presentations.pages/shapes#Page.Shape/)\non a page. You can retrieve other\n[`PageElement`](/workspace/slides/api/reference/rest/v1/presentations.pages#Page.PageElement)\nkinds by specifying them using the `fields` parameter. For example,\n`fields=pageElements(line,table)` only returns information about\n[`line`](/workspace/slides/api/reference/rest/v1/presentations.pages/lines#Page.Line) and\n[`table`](/workspace/slides/api/reference/rest/v1/presentations.pages/tables#Page.Table)\npage elements, if any are present on the page.\n| The Slides API [`presentations.pages.get`](/workspace/slides/api/reference/rest/v1/presentations.pages/get) request can return every property a shape has, including ones the API can't edit.\n\nThe following is the request protocol to read shape elements from a page:\n\n\u003cbr /\u003e\n\n```\nGET https://slides.googleapis.com/v1/presentations/PRESENTATION_ID/pages/PAGE_ID?fields=pageElements.shape\n```\n\nThe response consists of a\n[`Page`](/workspace/slides/api/reference/rest/v1/presentations.pages#resource-page) object\ncontaining the shape elements requested. The empty braces indicate page elements\nthat are not of the shape type; in this case, they're image page elements. \n\n```carbon\n{\n \"/workspace/slides/api/reference/rest/v1/presentations.pages#Page.PageElement\": [\n {},\n {},\n {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/shapes#Page.Shape/\": {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/shapes#Page.ShapeProperties\" {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.Outline\" {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.DashStyle\": \"SOLID\",\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.OutlineFill\": {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.SolidFill\": {\n \"alpha\": 1,\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.OpaqueColor\": {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.RgbColor\": {}\n }\n },\n },\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.PropertyState\": \"NOT_RENDERED\",\n \"/workspace/slides/api/reference/rest/v1/Dimension\": {\n \"magnitude\": 9525,\n \"/workspace/slides/api/reference/rest/v1/Unit\": \"EMU\"\n }\n },\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.Shadow\": {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.RectanglePosition\": \"BOTTOM_LEFT\",\n \"alpha\": 1,\n \"/workspace/slides/api/reference/rest/v1/Dimension\": {\n \"/workspace/slides/api/reference/rest/v1/Unit\": \"EMU\"\n },\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.OpaqueColor\": {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.RgbColor\": {}\n },\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.PropertyState\": \"NOT_RENDERED\",\n \"rotateWithShape\": false,\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.AffineTransform\": {\n \"scaleX\": 1,\n \"scaleY\": 1,\n \"/workspace/slides/api/reference/rest/v1/Unit\": \"EMU\"\n },\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/shapes#Page.Type_2\": \"OUTER\"\n },\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/shapes#Page.ShapeBackgroundFill\" : {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.PropertyState\": \"NOT_RENDERED\",\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.SolidFill\": {\n \"alpha\": 1,\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.OpaqueColor\": {\n \"/workspace/slides/api/reference/rest/v1/presentations.pages/other#Page.RgbColor: {\n \"blue\": 1,\n \"green\": 1,\n \"red\": 1\n }\n }\n }\n }\n },\n \"shapeType\": \"TEXT_BOX\",\n \"text\": {\n \"textElements\": [\n {\n \"endIndex\": 11,\n \"paragraphMarker\": {\n \"style\": {\n \"alignment\": \"START\",\n \"direction\": \"LEFT_TO_RIGHT\",\n \"indentEnd\": {\n \"unit\": \"PT\"\n },\n \"indentFirstLine\": {\n \"unit\": \"PT\"\n },\n \"indentStart\": {\n \"unit\": \"PT\"\n },\n \"lineSpacing\": 100,\n \"spaceAbove\": {\n \"unit\": \"PT\"\n },\n \"spaceBelow\": {\n \"unit\": \"PT\"\n },\n \"spacingMode\": \"COLLAPSE_LISTS\"\n }\n }\n },\n {\n \"endIndex\": 11,\n \"textRun\": {\n \"content\": \"Baby Album\\n\",\n \"style\": {\n \"backgroundColor\": {},\n \"baselineOffset\": \"NONE\",\n \"bold\": false,\n \"fontFamily\": \"Arial\",\n \"fontSize\": {\n \"magnitude\": 14,\n \"unit\": \"PT\"\n },\n \"foregroundColor\": {\n \"opaqueColor\": {\n \"rgbColor\": {}\n }\n },\n \"italic\": false,\n \"smallCaps\": false,\n \"strikethrough\": false,\n \"underline\": false\n }\n }\n }\n ]\n }\n }\n },\n ...\n ]\n}\n```"]]