# Google Docs

You may connect your Google Docs Account with BotDistrikt.

Navigate to **Integrations** and click on **Docs**

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2Fi2SYSIsMuWWOeItuJQ11%2Fdocs.png?alt=media&#x26;token=2902745f-3f9f-49e8-8f02-1c496c91cc95" alt=""><figcaption></figcaption></figure>

You will be presented with two options to integrate Google Docs with the BotDistrikt platform.&#x20;

* Use a User Account - allows you to connect to Google Docs from your personal user account.
* Use a Service Account - allows you to connect to Google Docs from a [service account](https://developers.google.com/identity/protocols/oauth2/service-account).

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FaVVodjhV3bq2XBoPNG9B%2FGoogle%20Docs%20Integration%20Options.png?alt=media&#x26;token=9de8b567-0bec-42b1-80c4-135482407991" alt=""><figcaption><p>Google Docs Integration Options</p></figcaption></figure>

### Use a User Account

1. Click on the **Sign in with Google** button and allow BotDistrikt to access your Google Account.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FsyGMqBKj85XACiHWLuVr%2Fuser%20account%20Use%20a%20User%20Account.png?alt=media&#x26;token=b1a5c7ce-4bd1-464c-92d2-ec3f044a8cb8" alt=""><figcaption><p>Use a User Account</p></figcaption></figure>

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FspEwvIsHdZHrVZhIbnia%2FSelect%20account.png?alt=media&#x26;token=9b36afce-d7c0-4128-bc68-3f0cf83cda60" alt="" width="188"><figcaption></figcaption></figure>

2. After successfully linking your Google account, you will be able to see all available documents in the dropdown selector.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FTtgbRbZF185kRSiqbFD6%2FScreenshot%202024-06-13%20at%204.56.34%E2%80%AFPM.png?alt=media&#x26;token=1fcead84-6fab-49c2-bbba-f4dbb1e0fa31" alt=""><figcaption><p>Successfully Integrated a User Account</p></figcaption></figure>

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FbomtEoA4e3IDaOWOddE1%2FAdding%20a%20Google%20Doc%20as%20a%20Source.png?alt=media&#x26;token=ac5ee753-e540-47c3-8908-4a4a4c42dbb1" alt=""><figcaption><p>Adding a Google Doc as a Source</p></figcaption></figure>

### Use a Service Account

1. To generate your Google Docs private key JSON file, you must first open the [API Library](https://console.cloud.google.com/apis/library).

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FCrkxal1gnDCPqAZGA5zg%2FService%20account.png?alt=media&#x26;token=a71e0f4e-0328-4e73-8688-ddf523bd54fc" alt=""><figcaption><p>Use a Service Account</p></figcaption></figure>

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FQIQY9jc9a2xaq4jYXsyx%2Fgoogle%20api.png?alt=media&#x26;token=af8812a3-a5ce-4794-a677-930ed17e0a95" alt=""><figcaption><p>API Library</p></figcaption></figure>

2. In the search bar on the API Library page, search for Google Docs API.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FJTRXdQvMTQH18lk7C48c%2Fdocs%20search.png?alt=media&#x26;token=fc1ae936-7e92-47bc-a887-67dade7ea987" alt=""><figcaption><p>Search for Google Docs API</p></figcaption></figure>

3. In the Google Docs API product details, click on **Enable**.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FSC0Drji0nZaDSVPQiHP4%2FGoogle%20Docs%20API.png?alt=media&#x26;token=b04bf604-c8ba-46c6-9cd3-af35a751258c" alt=""><figcaption><p>Google Docs API</p></figcaption></figure>

4. At the APIs & Services dashboard, click on **Credentials** at the left navigation panel. Once at the Credentials tab, click on **Create Credentials** and select **Service Account** from the dropdown menu.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FrkJs1opgG8TiFkN2lYEr%2FSheets%20create%20credentials%20copy.png?alt=media&#x26;token=e903f5fd-a3e2-4d6a-ade3-8e8f137c7f98" alt=""><figcaption><p>Create Credentials</p></figcaption></figure>

5. Once at the Create service account page, fill in the necessary information for the service account details and permissions, and click **Done**.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FiLF0OdXuxkwnM6Ps0Qvb%2FCreate%20Service%20Account.png?alt=media&#x26;token=12b9a2f7-81c8-4afb-9c81-63f62cacab4c" alt=""><figcaption><p>Create Service Account</p></figcaption></figure>

6. At the service account dashboard, click on the hyperlinked email address of the service account that was just created to access the Service account details page.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FW9fYnP4inubo3tbxQtyq%2FService%20Accounts%20for%20a%20Project.png?alt=media&#x26;token=293ee3fa-efca-4341-b474-a4873691adc2" alt=""><figcaption><p>Service Accounts for a Project</p></figcaption></figure>

7. Click on the **Keys** tab to view all service account keys. Click on **Add Key** and from the dropdown menu, select **Create new key**.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FF5zQqdkVZOdIs5UMPEVy%2FSheets%20service%20account%20key.png?alt=media&#x26;token=0c7d59f5-deb7-479c-a37b-5d78ca2b55e0" alt=""><figcaption></figcaption></figure>

8. In the modal that appears, select the JSON key type option and click on **Create**. You will be prompted to download the JSON file.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FGjNCyRD9iMM0maLcCUyt%2FSheets%20service%20account%20modal.png?alt=media&#x26;token=7d6d3d7e-df67-4579-8924-318e1dd6d222" alt=""><figcaption><p>Select a Key Type</p></figcaption></figure>

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2F792YENNjA2ut79yMrng2%2FDoc%20Private%20Key%20Successfully%20Saved.png?alt=media&#x26;token=9c49a165-83ee-4ea1-99c8-04dd37f55acc" alt=""><figcaption><p>Private Key Successfully Saved</p></figcaption></figure>

9. Before uploading the JSON file on BotDistrikt’s platform, please ensure that the Google Drive API is enabled. This can be done by searching for Google Drive API in the search bar on the API Library page and clicking on the **Enable** button.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2F6FGyBpivztauhLMcDhUI%2FGoogle%20Drive%20API.png?alt=media&#x26;token=a694658b-b29a-4a0f-bc2c-62fc30b2c700" alt=""><figcaption><p>Search for Google Drive API</p></figcaption></figure>

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2F7Ia7XlHwidLxsrVASpTh%2FGoogle%20Drive%20API%20inactive.png?alt=media&#x26;token=42deef97-93e5-4dde-86b5-8361a9f89354" alt=""><figcaption><p>Google Drive API</p></figcaption></figure>

10. At the Google Docs integration page on BotDistrikt’s platform, upload the JSON file containing the private key to link the service account.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2Fq2rzFLsgdt68fURIlg5R%2FUpload%20JSON%20Containing%20Private%20Key.png?alt=media&#x26;token=17b01635-e94f-435a-8771-ec04a111c28b" alt=""><figcaption><p>Upload JSON Containing Private Key</p></figcaption></figure>

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FaiRk7gXr0xpgfXXZkmxD%2Flinked%20service%20account%20doc.png?alt=media&#x26;token=7c1e767c-727c-4a1f-bd26-597e8f56771a" alt=""><figcaption></figcaption></figure>

### Add Sources with a Service Account

1. To add a document as a source on the BotDistrikt platform via a Service Account, share the file with the service account email address.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2Fth0qTxx1Rxu7ggYAu59F%2FSharing.png?alt=media&#x26;token=316a798f-b3ea-402e-a0e2-1f83c86aefb5" alt=""><figcaption><p>Sharing File with Service Account Email</p></figcaption></figure>

2. Once shared, the file should show up as an available document to be used as a source on the BotDistrikt platform.

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2FQft8OZZrT1KDHYv7V7wq%2FDocument%20added.png?alt=media&#x26;token=bb9a8ef6-207a-424c-aa51-3243c6aec8d2" alt=""><figcaption><p>Shared File Showing as Available</p></figcaption></figure>

You can now head on to Sources to [train your LLM to learn from your Google Docs](https://docs.botdistrikt.com/features/sources/google-docs)
