# Google sheets

## Overview

With Joule’s **Google Sheets connector**, you can seamlessly pull row data from spreadsheets, transform it, and stream it into your real-time pipelines.

{% hint style="info" %}
**Client library:** com.google.api-client:google-api-client:2.7.0
{% endhint %}

## Examples & DSL attributes

This configuration sets up the consumer to read row data from a specified Google Spreadsheet, with the `nasdaq` tab defined as the source. Custom deserialization can also be applied to transform the incoming data as needed.

```yaml
google sheets consumer:
  application name: Joule google sheets test
  spreadsheetId: 1PNhq2t7fJ8AqJBmlSvywdpI4maFaAaUC
  range: 'Nasdaq'

  event type: 'Nasdaq'
  polling frequency: 5
  header included: true

  oauth:
      credentials filepath: /home/joule/credentials/sheets/credentials.json
```

## Setting up

{% stepper %}
{% step %}

### Setup google project and enable spreadsheet API

Create a [project](https://developers.google.com/workspace/guides/create-project) and enable Google Spreadsheet API.&#x20;
{% endstep %}

{% step %}

### Configure consent and download credentials&#x20;

To access the spreadsheet Joule needs the user credentials to be created and downloaded. This can be done from the [Google Developers Console](https://console.developers.google.com/). &#x20;
{% endstep %}

{% step %}

### Prepare the spread with data

Load the spreadsheet with data you need to process. This data relates to the example above.

<figure><img src="https://3062398388-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUU6FZlV07ZD90OzbzGww%2Fuploads%2FvxQuQ6kDtzbZyY6zzAHe%2FScreenshot%202025-09-08%20at%2016.14.33.png?alt=media&#x26;token=558c84fb-2ef6-4102-8967-788c83daa193" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Copy the spreadsheet id from the URL e.g. [https://docs.google.com/spreadsheets/d/**1PNhq2t7fJ8AqJBmlSvywdpI4maFaAaUC-BUTyIc8utg**](https://docs.google.com/spreadsheets/d/1PNhq2t7fJ8AqJBmlSvywdpI4maFaAaUC-BUTyIc8utg)
{% endhint %}
{% endstep %}

{% step %}

### Define and deploy source configuration

```yaml
google sheets consumer:
  application name: Joule google sheets test
  spreadsheetId: 1PNhq2t7fJ8AqJBmlSvywdpI4maFaAaUC
  range: 'Nasdaq'

  event type: 'Nasdaq'
  polling frequency: 5
  header included: true

  oauth:
      credentials filepath: /home/joule/credentials/sheets/credentials.json
```

{% endstep %}

{% step %}

### Now you are ready to subscribe and use the data

Deploy a use case that subscribes to the spreadsheet.
{% endstep %}
{% endstepper %}

{% hint style="success" %}
Follow the official google [documentation](https://developers.google.com/workspace/guides/configure-oauth-consent) for more information on setting up projects on GCP
{% endhint %}

### Attributes schema

<table><thead><tr><th width="178">Attribute</th><th width="281">Description</th><th width="191">Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>application name</td><td>Application name</td><td>String</td><td>true</td></tr><tr><td>spreadsheetId</td><td>Spreadsheet id that is embedded in the url</td><td>String</td><td>true</td></tr><tr><td>range</td><td>Target sheet and start cell</td><td>String</td><td>true</td></tr><tr><td>event type</td><td>Specify the emitting StreamEvent type</td><td>String</td><td>true</td></tr><tr><td>polling frequency</td><td>Frequency on minutes the spreadsheet is called to download data</td><td>Integer<br>Default: 1 minute</td><td>false</td></tr><tr><td>header included</td><td>Boolean to inform the default deserializer the first row is the header</td><td>Boolean<br>Default: true</td><td>false</td></tr><tr><td>oauth</td><td>OAuth configuration</td><td>See OAuth <a href="#oauth-attribute">section</a></td><td>true</td></tr><tr><td>deserialiser</td><td>For custom deserialization </td><td>See Deserializer <a href="../serialisers/deserialisers">documentation</a></td><td>false</td></tr></tbody></table>

### OAuth Attribute

<table><thead><tr><th width="178">Attribute</th><th width="281">Description</th><th width="191">Data Type</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>credentials filepath</td><td>Path to the google OAuth consent credentials file.</td><td>String</td><td>true</td></tr></tbody></table>

##
