# Setting up a Google Sheets connector

### Google Sheets Connector

This connector is used to retrieve data from a Google spreadsheet.

### Add a Google sheets connection

* As soon as you click on the connector icon, you will be redirected by google to sign in to your account, in order to access to your google sheet. If not click on the button `GRANT AUTHORIZATION` to display the window
* After logging in, you shall be redirected back to Toucan, where you will have the required attributes automatically filled by Toucan.
* fill the fields necessary

| Field                                          | Format / Type | Description                                                                                                                                                                                                                                                                             | Example                    |
| ---------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
| Name (mandatory)                               | String        | Use it to identify your connection                                                                                                                                                                                                                                                      | *MyGoogleSheetsConnection* |
| Retry Policy (optional)                        | Boolean       | <p><em>Boolean</em> allows to configure a retry policy if the connection is flaky.</p><ul><li>max attempts: maximum number of retries before giving up</li><li>max\_delay: in seconds, above the connection is dropped</li><li>wait\_time: time in seconds between each retry</li></ul> |                            |
| Slow Queries' Cache Expiration Time (optional) | Integer       | Slow queries' cache expiration time in seconds                                                                                                                                                                                                                                          |                            |

* Now, click on the `SAVE` button

{% hint style="success" %}
After successfully configuring the connector, you will be able to find it in the Connector section of the DataHub "Datasource" tab
{% endhint %}

### Create a dataset from a Google sheets connection

{% hint style="warning" %}
This connector does not support Excel files (.xls, .xlsx, etc.) saved on Google Drive.
{% endhint %}

* In the Edit datasource section
  * `ID OF THE SPREADSHEET` (**mandatory**): string, Fill this field with the spreadsheet id which can be found in the url to access your google spreadsheet after the`https://docs.google.com/spreadsheets/d/` (For example if your URL is `https://docs.google.com/spreadsheets/d/a98db973kwl8xp1lz94kjf0bma5pez8c` then the id is `a98db973kwl8xp1lz94kjf0bma5pez8c)`

<details>

<summary>Find a spreadsheet ID of a google sheets</summary>

You can have a look at this below image to have an understanding of ‘where to find’ the required parameters for filling the data source config:

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-94f2eaea21dc7d8b4544f7fed3005493c14076ec%2Fimage.png?alt=media" alt=""><figcaption><p>ID of a spreadsheet in Google sheets</p></figcaption></figure>

</details>

* `SHEET TITLE` (optional): string, title of the sheet you want to get, once you have fill your spreadsheet id, we will get all the sheet that exist and they will be displayed in a dropdown
* `HEADER ROW` (optional): int, default to 0. Row of the header of the spreadsheet
* `Dates as float` (optional): boolean, render date as float or string from the sheet true by default

Once you have fill all the necessary fields, you can click on

* `PREVIEW` to see the data Toucan will get from your Google sheets
* `VALIDATE`, your data will be created and you will redirected to the YouPrep interface

{% hint style="info" %}
For more info, see the dedicated section [creating-datasets](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/managing-datasets/creating-datasets "mention")
{% endhint %}

{% hint style="success" %}
After selecting data from your connector you will be able to create a dataset thanks to [YouPrep](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm) using the selection as "source step".
{% endhint %}
