> For the complete documentation index, see [llms.txt](https://helpdocumentation.gitbook.io/user/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpdocumentation.gitbook.io/user/bot-builder/whatsapp-chatbot/google-sheet-blocks/fetch-data-from-google-sheets-and-create-dynamic-buttons-list.md).

# Fetch Data from Google Sheets & Create Dynamic Buttons/List

This guide explains how to fetch user data from **Google Sheets** and display it as **dynamic buttons or lists** in a bot flow.

#### Step 1: Create Bot Flow

1. Go to **Chatbot → Create Botflow**
2. Add **trigger (keyword)**
3. Select channel and save

#### Step 2: Capture Phone Number

* Ask user if their **WhatsApp number is the billing number**
  * If **Yes** → Save WhatsApp number
  * If **No** → Ask for billing number and save input

#### Step 3: Fetch Data from Google Sheets

1. Add **Automation → Google Sheets → Lookup Rows**
2. Select authentication and spreadsheet
3. Enter column (e.g., Phone Number column)
4. Set condition (**equals**)
5. Map phone number variable
6. Run once and then **Save**

#### Step 4: Store Retrieved Data

* Save:
  * Number of rows found
  * Full response data
* Use **Bot Fields** for storage

#### Step 5: Apply Conditions

* If **no data found (rows = 0)**
  * Send message: *No complaint found*
  * Redirect user (Go To block)
* If **data found (rows > 0)**
  * Proceed to next step

#### Step 6: Create Dynamic List

1. Add **Interactive Message**
2. Select **Dynamic List**
3. Map:
   * Title → Name
   * Description → Complaint Number
   * Value → Unique field (e.g., Complaint Number)
4. Save user selection

#### Step 7: Show Complaint Status

* Send message with mapped **complaint status**
* Save and **Enable workflow**

{% embed url="<https://www.youtube.com/watch?v=G8YA2m5R6Ps>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://helpdocumentation.gitbook.io/user/bot-builder/whatsapp-chatbot/google-sheet-blocks/fetch-data-from-google-sheets-and-create-dynamic-buttons-list.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
