# Connect WhatsApp and Google Sheets to Collect Responses

> **Who can use this Card?**
>
> * Gallabox Users having permission to either build and deploy bots or manage bots.
> * Available on all Paid Plans.&#x20;

## Overview

Unlock the potential of our Google Sheet connector to effortlessly store and manage customer data from your chat-flow. This guide will walk you through the seamless process, ensuring a smooth integration between your conversational interface and Google Sheets.

{% hint style="info" %}
Make sure you have the spreadsheet ready with the sheet and columns defined.
{% endhint %}

### Google Sheet Operations

Here's a summary of the operations you can perform with the Google Sheet connector.

<table><thead><tr><th width="218">Operation</th><th>Description</th></tr></thead><tbody><tr><td><strong>Add New Row</strong></td><td>Add a Row to the Google Sheet.</td></tr><tr><td><strong>Update Row</strong></td><td>Update Rows in a Sheet using a Reference Column.</td></tr><tr><td><strong>Fetch the Row Value</strong></td><td>Fetch Row in a Sheet using a reference column.</td></tr><tr><td><strong>Fetch the first 10 matched Row Value</strong></td><td>Fetch Rows in a Sheet using a reference column.</td></tr></tbody></table>

## Connect your Google sheet

1. Click on **Connections** from the left pane and select **Google Sheet** from the list as shown in the Gif below.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FD7RjiwIggm4mrtw0R4sk%2FSelect-the-GoogleSheet-Connecto.gif?alt=media&#x26;token=b1884499-5808-4765-a15e-3167a166add7" alt=""><figcaption></figcaption></figure>

2. Click on any action out of four listed - **Add new Row**, **Update Row**, **Fetch Row Value**, and **Fetch the first 10 Matched Row Values**.&#x20;

For clarity, we will choose the action - **Add New Row**.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FYeVflpHW8pkGA4wqpmxv%2FSelect-the-Actiongoogle-sheet.gif?alt=media&#x26;token=46d0879a-8cfe-46df-82f1-20433a0b6b6a" alt=""><figcaption></figcaption></figure>

3. Now Connect your Google account by clicking on **Connect Now** to create a New Connection and click on Save.

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

4. Sign in to Google will be prompted and you have to sign in using the email address the google sheet has owner access with.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FZ3IC0sXe3PyGH09coNb0%2FGoogle-Sign-in.gif?alt=media&#x26;token=b038e2ea-2472-4a06-be76-8e5129dd5894" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The google sheet connector is recommended to be connected at the start of the flow to gather all the details.
{% endhint %}

## Using the Google Sheets Connector

### **Add New Row**

1. After you create a connection and Go to **Select Existing Connection** tab and you will see the connection that you created on top and the connections previously created after that. Click on the connection you created, and it will take you to edit the Action you choose previously - **Add New Row**. &#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2Fte664jbOu5lQlzAQDlFk%2FSelect-existing%20connection.gif?alt=media&#x26;token=ec24e8af-8400-4048-93af-92f841285258" alt=""><figcaption></figcaption></figure>

2. To choose the **spreadsheet,** click on upload button to select form your google drive.&#x20;

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

3. To add the row values, you have to select the Column name (from the sheet you choose in the previous step) from the dropdown and for the value, you have to select the variable that you have defined to store the value from the user. \
   For example: The sheet we selected has 3 columns - Name, Phone, and Email. We are pushing the data for all the three columns.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FLAEOUMXK5LiDbYTQlfrl%2FAdd_variables.gif?alt=media&#x26;token=badad4aa-702d-4133-8cdf-5bc4180cf6a9" alt=""><figcaption></figcaption></figure>

4. After bot gets triggered and the customer responds to it, that data will be captured in Google Sheet as shown below:

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FPr5fwLfoQrdWU4maOZQf%2FSample_values_add_new_row.png?alt=media&#x26;token=a394f6df-c0c9-400f-929b-b82a56dfa9b2" alt=""><figcaption></figcaption></figure>

### **Update Row**

This action is used when you want to update the data already in a particular row.&#x20;

1. Go to **Google sheet Connector** click on Action - Update Row. Select the connection - Test you created before to edit the Action as shown in the below GIF.&#x20;

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

2. To choose the **spreadsheet,** click on upload button to select form your google drive.&#x20;

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

3. For the *Row Values*, you have to select the Column name (from the sheet you choose in the previous step) from the dropdown that you want to update and in the value choose the variable that had the previous value. \
   \
   For the *Update Row Values*, you have to select the same Column name(from the sheet you choose in the previous step) from the dropdown that you want to update and in the value choose the new variable that stores the new information you want to update.&#x20;

For example: We will select the column - Name.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FvYcxF2Q56bKehHugHCiO%2FUpdate-Row%20Column.gif?alt=media&#x26;token=0633bfd7-264c-4a26-b8c2-f7fb2bf9cfd6" alt=""><figcaption></figcaption></figure>

4. After bot gets triggered and the customer responds to it, that data will be updated in Google Sheet as shown below:

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FqMbAsr0jwrd87msnZd2L%2FSample_values_update_row.png?alt=media&#x26;token=f0d39426-ae57-4345-a68b-78c8048d0fff" alt=""><figcaption></figcaption></figure>

### Fetch the Row Value

1. Go to **Google sheet Connector** click on Action - **Fetch the Row Value**. Select the connection - Test you created before to edit the Action as shown in the below GIF.&#x20;

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

2. To choose the **spreadsheet,** click on upload button to select form your google drive.&#x20;

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

3. To choose the reference row values, you have to select the Column name (from the sheet you choose in the previous step) from the dropdown and for the value, you have to select the variable that you have defined to store the value from the user. \
   \
   For Get the Row Values, you have to select the Column name and the variable you would like to fetch.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FVOsLZrVyhAp2KbgyNhVy%2FVariables-Fetch-Row%20Value.gif?alt=media&#x26;token=1ddb1a8f-3b57-4da8-af22-78aea0832781" alt=""><figcaption></figcaption></figure>

### Fetch the first 10 matched Row Value

1. Go to **Google sheet Connector** click on Action - **Fetch the first 10 matched Row Value**. Select the connection - Test you created before to edit the Action as shown in the below GIF.&#x20;

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FM1ETtlU51LMsFm5rOw7x%2Ffetch-10-row%20value.gif?alt=media&#x26;token=da033972-e4ba-4716-a762-9d273650bcfd" alt=""><figcaption></figcaption></figure>

2. To choose the **spreadsheet,** click on upload button to select form your google drive. &#x20;

<figure><img src="broken-reference" alt=""><figcaption></figcaption></figure>

3. To choose the reference row values, you have to select the Column name (from the sheet you choose in the previous step) from the dropdown and for the value, you have to select the variable that you have defined to store the value from the user. For Get the Row Values, you have to select the Column name and the variable you would like to fetch. Click on Save.&#x20;

For example: The first 10 matching rows will be fetched from the selected sheet, which contains names and their corresponding task titles.

<figure><img src="https://3137140735-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZcl3T6ePz95GpzjAeOLW%2Fuploads%2FDCU8FPj05K7ljjbWLtYi%2Fgoogle_sheet.gif?alt=media&#x26;token=21dbd2db-e12e-4966-8fe8-b6a129a621e2" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You will have two **conditions** after every Action to carry forward your chat-flow - one is **On success** and other is **On Fail** Condition.
{% endhint %}

With the Google Sheet connector seamlessly integrated into your chat-flow, managing and updating customer data becomes a breeze. Whether you're adding new rows, updating existing data, or fetching specific values, follow our step-by-step instructions to optimize your workflow and enhance data-driven decision-making.

<br>
