ภาพรวมของ Google Docs API
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Google เอกสาร API ช่วยให้คุณสร้างและแก้ไขเอกสารใน Google เอกสารได้
แอปพลิเคชันสามารถผสานรวมกับ Docs API เพื่อสร้างเอกสารที่ดูดี
จากข้อมูลที่ผู้ใช้และระบบระบุ Docs API ช่วยให้คุณทำสิ่งต่อไปนี้ได้
- ทำให้กระบวนการเป็นแบบอัตโนมัติ
- สร้างเอกสารหลายรายการพร้อมกัน
- จัดรูปแบบเอกสาร
- สร้างใบแจ้งหนี้หรือสัญญา
- ดึงข้อมูลแอตทริบิวต์ที่เฉพาะเจาะจงของออบเจ็กต์
ต่อไปนี้คือรายการคำศัพท์ทั่วไปที่ใช้ใน Docs API
- รหัสเอกสาร
ตัวระบุที่ไม่ซ้ำกันสำหรับเอกสาร โดยเป็นสตริงเฉพาะที่มีตัวอักษร ตัวเลข และสัญลักษณ์พิเศษบางอย่างที่อ้างอิงถึงเอกสาร และสามารถดึงข้อมูลจาก URL ของเอกสารได้ รหัสเอกสารจะคงที่ แม้ว่าชื่อเอกสารจะเปลี่ยนไปก็ตาม ดูข้อมูลเพิ่มเติมเกี่ยวกับวิธีค้นหารหัสได้ที่
รหัสเอกสาร
https://docs.google.com/document/d/DOCUMENT_ID/edit
- องค์ประกอบ
โครงสร้างที่ประกอบกันเป็นเอกสาร องค์ประกอบระดับบนสุดของเอกสาร
ประกอบด้วย Body
,
DocumentStyle
และ
List
- เอกสารใน Google Workspace
ไฟล์ที่แอปพลิเคชัน Google Workspace เช่น Google เอกสาร สร้างขึ้น
รูปแบบประเภท MIME สำหรับเอกสารคือ
application/vnd.google-apps.document
ดูรายการประเภท MIME ได้ที่
ประเภท MIME ที่ Google Workspace และ Google ไดรฟ์รองรับ
- ดัชนี
องค์ประกอบส่วนใหญ่ภายในเนื้อหาของเนื้อหามีพร็อพเพอร์ตี้ startIndex
และ endIndex
ระบุออฟเซ็ตของจุดเริ่มต้นและจุดสิ้นสุดขององค์ประกอบ
เทียบกับจุดเริ่มต้นของกลุ่มที่ล้อมรอบ
- รูปภาพในบรรทัด
รูปภาพที่ปรากฏในโฟลว์ของข้อความภายในเอกสาร ซึ่งไม่ใช่ไฟล์แนบ
- ช่วงที่ตั้งชื่อแล้ว
ช่วงข้อความที่ต่อเนื่องกัน NamedRange
คือ
คอลเล็กชันของช่วงที่มี namedRangeId
เดียวกัน ช่วงที่ตั้งชื่อช่วยให้
นักพัฒนาซอฟต์แวร์เชื่อมโยงส่วนต่างๆ ของเอกสารกับป้ายกำกับที่ผู้ใช้กำหนดเอง
ได้ตามต้องการ เพื่อให้สามารถอ่านหรือแก้ไขเนื้อหาแบบเป็นโปรแกรมได้ในภายหลัง
เอกสารอาจมีช่วงที่ตั้งชื่อหลายช่วงซึ่งมีชื่อเดียวกัน แต่ช่วงที่ตั้งชื่อทุกช่วงจะมีรหัสที่ไม่ซ้ำกัน
- Segment
Body
, Header
,
Footer
หรือ
Footnote
ที่มีองค์ประกอบเชิงโครงสร้างหรือเนื้อหา ดัชนีขององค์ประกอบภายใน
กลุ่มจะสัมพันธ์กับจุดเริ่มต้นของกลุ่มนั้น
- คำแนะนำ
การเปลี่ยนแปลงในเอกสารโดยไม่ต้องเปลี่ยนแปลงข้อความต้นฉบับ หากเจ้าของ
อนุมัติคำแนะนำของคุณ คำแนะนำก็จะแทนที่ข้อความต้นฉบับ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Google Docs API overview\n\nThe Google Docs API lets you create and modify documents in Google Docs.\n\nApplications can integrate with the Docs API to create polished\ndocuments from both user and system-provided data. The Docs API lets\nyou:\n\n- Automate processes\n- Create documentation in bulk\n- Format documents\n- Generate invoices or contracts\n- Retrieve specific attributes of objects\n\nThe following is a list of common terms used in the Docs API:\n\n*Document ID*\n\n: The unique identifier for a document. It's a particular string containing\n letters, numbers, and some special characters that reference a document and\n it can be derived from the document's URL. Document IDs are stable, even if\n the document name changes. For more information on how to find the ID, see\n [Document ID](/workspace/docs/api/concepts/document#document-id).\n\n https://docs.google.com/document/d/\u003cvar translate=\"no\"\u003eDOCUMENT_ID\u003c/var\u003e/edit\n\n*Element*\n\n: The structure that makes up a document. Top-level elements of a document\n include the [`Body`](/workspace/docs/api/reference/rest/v1/documents#body),\n [`DocumentStyle`](/workspace/docs/api/reference/rest/v1/documents#documentstyle), and\n [`List`](/workspace/docs/api/reference/rest/v1/documents#list).\n\n*Google Workspace document*\n\n: A file that a Google Workspace application, like Google Docs, creates.\n The MIME type format for Docs is\n `application/vnd.google-apps.document`. For a list of MIME types, see [Google Workspace and Google Drive supported MIME types](/drive/api/guides/mime-types).\n\n*Index*\n\n: Most *elements* within the content body have the `startIndex` and `endIndex`\n properties. These indicate the offset of an element's beginning and end,\n relative to the beginning of its enclosing *segment*.\n\n*Inline image*\n\n: An image that appears in the flow of text within a document. It's not an\n attachment.\n\n*Named range*\n\n: A contiguous range of text. A\n [`NamedRange`](/workspace/docs/api/reference/rest/v1/documents#namedrange) is a\n collection of ranges with the same `namedRangeId`. Named ranges allow\n developers to associate parts of a document with an arbitrary user-defined\n label so their contents can be programmatically read or edited later. A\n document can contain multiple named ranges with the same name, but every\n named range has a unique ID.\n\n*Segment*\n\n: The `Body`, [`Header`](/workspace/docs/api/reference/rest/v1/documents#header),\n [`Footer`](/workspace/docs/api/reference/rest/v1/documents#footer), or\n [`Footnote`](/workspace/docs/api/reference/rest/v1/documents#footnote) containing\n structural or content *elements* . The *indexes* of the elements within a\n segment are relative to the beginning of that segment.\n\n*Suggestion*\n\n: Changes to a document without changing the original text. If the owner\n approves your suggestions, they replace the original text.\n\nRelated topics\n--------------\n\n- To learn about developing with Google Workspace APIs, including handling\n authentication and authorization, refer to [Develop on\n Google Workspace](/workspace/guides/get-started).\n\n- To get a conceptual overview of a document, see\n [Document](/workspace/docs/api/concepts/document).\n\n- To learn how to configure and run a Docs API app, try the\n [JavaScript quickstart](/workspace/docs/api/quickstart/js)."]]