# Google Sheets

You may connect your Google Sheets Account with BotDistrikt.

Navigate to **Integrations** and click on **Sheets**

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2F28m4k71BUs7nJbVrSxhJ%2FSheets.png?alt=media&#x26;token=57a244ed-1397-4d1b-b2c9-27223c2c8205" alt=""><figcaption></figcaption></figure>

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

* Use a User Account - allows you to connect to Google Sheets from your personal user account.
* Use a Service Account - allows you to connect to Google Sheets 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%2FpCWY9YJ6KJ0iPGpiHsCC%2FScreenshot%202024-06-13%20at%206.02.09%E2%80%AFPM.png?alt=media&#x26;token=c139ca0f-669d-4420-bd9d-02662a7c9836" alt=""><figcaption><p>Google Sheets 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%2FBje511EmpMdDbOXQOqmU%2FScreenshot%202024-06-13%20at%206.02.11%E2%80%AFPM.png?alt=media&#x26;token=15d7b545-78d6-403f-9a96-89e9ad59f0a9" 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%2FivDxl1JN79zq3h8D4I4K%2FPermission.png?alt=media&#x26;token=4b43cdc3-5b8e-4233-8ade-072ba216c2f5" alt="" width="188"><figcaption></figcaption></figure>

2. After successfully linking your Google account, you will be able to see all available spreadsheets 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%2FjCsOxSs2t6xfPxM70JQk%2FScreenshot%202024-06-13%20at%206.02.34%E2%80%AFPM.png?alt=media&#x26;token=8bd1212c-8e33-4ab7-92cd-0ce337dbf076" 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%2FEjeLAxFAvi9wilvguBGy%2FScreenshot%202024-06-13%20at%206.02.48%E2%80%AFPM.png?alt=media&#x26;token=a5c29d86-cb99-4021-8438-bf3ea74dca6d" alt=""><figcaption><p>Adding a Google Sheet as a Source</p></figcaption></figure>

### Use a Service Account

1. To generate your Google Sheets 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%2FmWAn2aEUJMHvZ7zh6RIc%2FScreenshot%202024-06-13%20at%206.13.24%E2%80%AFPM.png?alt=media&#x26;token=01fb996d-02c0-408e-b5c2-3327ecfb366a" 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%2F0c9vf32tRkaeEqiRIpYf%2Fgoogle%20api.png?alt=media&#x26;token=2079262b-3e71-4eef-927a-aee9bea87f68" alt=""><figcaption><p>API Library</p></figcaption></figure>

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

<figure><img src="https://2535542804-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LirAdLo22OkAW9w3tvY%2Fuploads%2Fp71szI5sL1pdKFXcSqfA%2Fsheets%20search.png?alt=media&#x26;token=e4c8f574-6622-40f7-8641-07dfde440357" alt=""><figcaption><p>Search for Google Sheets API</p></figcaption></figure>

3. In the Google Sheets 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%2FlOKfPbMvDAUb3HhlZm7o%2FGoogle%20Sheets%20API.png?alt=media&#x26;token=80a014bd-ebb2-4c0b-82e9-40a7b2166a3c" alt=""><figcaption><p>Google Sheets 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%2FKDWwlCKfDtPvao4gBd7X%2FSheets%20create%20credentials.png?alt=media&#x26;token=3498d190-9bf4-4ba6-837c-7cde93b719d1" 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%2FTyCdrTfd1feXh68l32Nk%2FSheets%20service%20account.png?alt=media&#x26;token=63963947-c079-436c-8592-cf971a9c63fb" 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%2FwMiHdRp5A0XzrXjhaRQ5%2FSheets%20create%20credentials.png?alt=media&#x26;token=dd886268-af66-41f8-8cc5-19ebea9abee0" 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%2F65T5WXyRE1dk5tAa6j33%2FSheets%20service%20account%20key.png?alt=media&#x26;token=b4f8bcab-43d3-4f85-b564-0b4cac9fc7ef" 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%2FUrlqosQnN5CDVJbRHY27%2FSheets%20service%20account%20modal.png?alt=media&#x26;token=6b64ec37-7d14-4afe-8db5-d1eb0dc4c1a7" 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%2FwaNVIAb44Ydk1Gq2ssui%2FSheet%20Private%20Key%20Successfully%20Saved.png?alt=media&#x26;token=646a7737-efde-4c23-a46a-8c403b8afa46" 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%2FBWZiG5lzN2a7wpgWQ1PQ%2FGoogle%20Drive%20API.png?alt=media&#x26;token=1c83229b-0b8b-4424-a83f-1906b7313f07" 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%2FIJP2MqxsINARzDfXy9Pm%2FGoogle%20Drive%20API%20inactive.png?alt=media&#x26;token=6196d944-57a8-4746-80ce-dfb0663f1b75" alt=""><figcaption><p>Google Drive API</p></figcaption></figure>

10. At the Google Sheets 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%2FGQS6tlnR2Ae2sd2I3mdk%2FSheet%20upload%20JSON%20file.png?alt=media&#x26;token=a42c3807-d69d-4588-a55e-b1e52c25ba90" 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%2FjIPyllkco6f62uJK3MFf%2FScreenshot%202024-06-13%20at%206.16.30%E2%80%AFPM.png?alt=media&#x26;token=27791e22-bf2f-4358-957a-b1c449e9d602" alt=""><figcaption></figcaption></figure>

### Add Sources with a Service Account

1. To add a sheet 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%2FSkWCoMdSlijWKWOtMJ65%2FScreenshot%202024-06-13%20at%206.19.30%E2%80%AFPM.png?alt=media&#x26;token=b0c47609-c6e3-43ea-ac2e-19b120859ab1" 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%2FQtOaiRIgMA3Fo5jLYWL1%2FScreenshot%202024-06-13%20at%206.20.40%E2%80%AFPM.png?alt=media&#x26;token=e5941db3-09b0-4cd9-bbe0-033d64bba06e" 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 Sheets](https://docs.botdistrikt.com/features/sources/google-sheets)
