> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/datasources/google-documents.md).

# Google Documents

Actions for handling Google Documents data

To use this actions you need to configure Google Cloude. See more:

{% content-ref url="/pages/FmiieOtdZ7EcfmHqapxN" %}
[Google Cloud](/integrations/google-cloud.md)
{% endcontent-ref %}

## Module: [implementation](/framework-structure.md#implementation).datasources.google\_docs

***

***

## <mark style="color:green;">GoogleDocsAction</mark>

Base Google Documents action. Subclass of [**Action**](/core/action.md)**.**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**client**</mark>**&#x20;(**[**GoogleCloudClient**](/apis/googlecloudclient.md)**):** Google client that will be used for access.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

***

***

## <mark style="color:green;">GoogleDocsCreate</mark>

Create document. Subclass of [**GoogleDocsAction**](/datasources/google-documents.md#googledocsaction). Type of \
[**GoogleDocsAction**](#googledocsaction)**\[Dict\[str, Any], Dict\[str, Any]]**.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:&#x20;
  * <mark style="color:red;">**"title"**</mark>**&#x20;(str):** Name of the document;

#### Raises:

* **Exception:** If unable to create document.

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:&#x20;
  * <mark style="color:red;">**"document\_id"**</mark>**&#x20;(str):** Document ID;

***

***

***

## <mark style="color:green;">GoogleDocsRead</mark>

Read document. Subclass of [**GoogleDocsAction**](/datasources/google-documents.md#googledocsaction). Type of \
[**GoogleDocsAction**](#googledocsaction)**\[Dict\[str, Any], Dict\[str, Any]]**.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:&#x20;
  * <mark style="color:red;">**"document\_id"**</mark>**&#x20;(str):** ID of the document. Document ID (can be found in url: <https://docs.google.com/documents/d/>*<mark style="color:purple;">**document\_id**</mark>*/edit#gid=0);

#### Raises:

* **Exception:** If unable to read document.

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:&#x20;
  * <mark style="color:red;">**"document"**</mark>**&#x20;(Dict\[str, Any]):** Document;

***

***

***

## <mark style="color:green;">GoogleDocsWrite</mark>

Write to document. Subclass of [**GoogleDocsAction**](/datasources/google-documents.md#googledocsaction). Type of \
[**GoogleDocsAction**](#googledocsaction)**\[Dict\[str, Any], Dict\[str, Any]]**.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:&#x20;
  * <mark style="color:red;">**"document\_id"**</mark>**&#x20;(str):** ID of the document. Document ID (can be found in url: <https://docs.google.com/documents/d/>*<mark style="color:purple;">**document\_id**</mark>*/edit#gid=0);
  * <mark style="color:red;">**"requests"**</mark>**&#x20;(Dict\[str, Any]):** Actions for updating the document. For more details see:

{% embed url="<https://developers.google.com/docs/api/concepts/request-response>" %}

{% embed url="<https://developers.google.com/docs/api/how-tos/move-text>" %}

#### Raises:

* **Exception:** If unable to update document.

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:&#x20;
  * <mark style="color:red;">**"document"**</mark>**&#x20;(Dict\[str, Any]):** Updated document;

***

***

***

## <mark style="color:green;">GoogleDocsClientConfig</mark>

Google Documents default configuration. Subclass of [**GoogleCloudClientConfig**](/apis/googlecloudclient.md#googlecloudclientconfig).

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**scopes**</mark>**&#x20;(List\[str]):** Access scopes. Defaults to \["<https://www.googleapis.com/auth/documents>"] **(Read and write acess to all documents).**
* <mark style="color:orange;">**service**</mark>**&#x20;(str):** Service name. Defaults to "docs" (Google Documents service).
* <mark style="color:orange;">**version**</mark>**&#x20;(str):** API version. Defaults to "v1".

***

***
