> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
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=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
