Обзор API Документов Google
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
API Google Docs позволяет создавать и изменять документы в Google Docs.
Приложения могут интегрироваться с API Docs для создания качественных документов на основе данных, предоставленных как пользователями, так и системой. API Docs позволяет:
- Автоматизировать процессы
- Массовое создание документации
- Форматировать документы
- Генерация счетов-фактур или контрактов
- Извлекать определенные атрибуты объектов
Ниже приведен список общих терминов, используемых в API Docs:
- Идентификатор документа
Уникальный идентификатор документа. Это определённая строка, содержащая буквы, цифры и некоторые специальные символы, которая ссылается на документ и может быть получена из URL-адреса документа. Идентификаторы документов остаются неизменными, даже если меняется название документа. Подробнее о том, как найти идентификатор, см. в разделе «Идентификатор документа» .
https://docs.google.com/document/d/DOCUMENT_ID/edit
- Элемент
Структура документа. К элементам верхнего уровня документа относятся Body
, DocumentStyle
и List
.
- Документ Google Workspace
Файл, создаваемый приложением Google Workspace, например Google Docs. Формат типа MIME для Docs — application/vnd.google-apps.document
. Список типов MIME см. в разделе «Поддерживаемые типы MIME для Google Workspace и Google Drive» .
- Индекс
Большинство элементов в теле контента имеют свойства startIndex
и endIndex
. Они указывают смещение начала и конца элемента относительно начала его окружающего сегмента .
- Встроенное изображение
Изображение, которое отображается в тексте документа. Не является вложением.
- Именованный диапазон
Непрерывный диапазон текста. NamedRange
— это коллекция диапазонов с одинаковым namedRangeId
. Именованные диапазоны позволяют разработчикам связывать части документа с произвольной пользовательской меткой, чтобы их содержимое можно было программно читать или редактировать позже. Документ может содержать несколько именованных диапазонов с одинаковым именем, но каждый именованный диапазон имеет уникальный идентификатор.
- Сегмент
Body
, Header
, Footer
или Footnote
, содержащие структурные или содержательные элементы . Индексы элементов внутри сегмента отсчитываются относительно начала этого сегмента.
- Предположение
Внесение изменений в документ без изменения исходного текста. Если владелец одобрит ваши предложения, исходный текст будет заменен.
Информацию о разработке с использованием API Google Workspace, включая обработку аутентификации и авторизации, см. в разделе Разработка в Google Workspace .
Чтобы получить концептуальный обзор документа, см. Документ .
Чтобы узнать, как настроить и запустить приложение Docs API, попробуйте быстрый старт JavaScript .
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. 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)."]]