> ## Documentation Index
> Fetch the complete documentation index at: https://relevanceai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Values in Range

> The Get Values in Range tool step allows you to retrieve data from your Google Sheet

## Add the ‘Get Values in Range’ Tool step to your Tool

<div
  style={{
position: "relative",
boxSizing: "content-box",
maxHeight: "80vh",
width: "100%",
aspectRatio: "2.06",
padding: "24px 0"
}}
>
  <iframe
    src="https://app.supademo.com/embed/cmdqy9zvy3xa09f96yt3tx1gl?embed_v=2&utm_source=embed"
    loading="lazy"
    title="Google Sheets Get Values in Range"
    allow="clipboard-write; fullscreen"
    webkitAllowFullscreen="true"
    mozAllowFullscreen="true"
    allowFullscreen
    style={{
  position: "absolute",
  top: 0,
  left: 0,
  width: "100%",
  height: "100%",
  border: "3px solid #5E43CE",
  borderRadius: "10px",
  objectFit: "cover"
}}
  />
</div>

You can add the ‘Get Values in Range’ Tool step to your Tool by:

1. Creating a new Tool, then searching for the ‘Get Values in Range’ Tool step
2. Click ‘Expand’ to see the full Tool step
3. Using the dropdown menu:
   * Select the Google account you would like to use.
   * Select the Drive you would like to use (defaults to "My Drive").
   * Select the Spreadsheet you would like to get the values from.
   * Select the worksheet you would like to get the values from.
4. Select the range of cells you would like to get the values from (e.g. `A1:B2`).
5. Click 'Run step' to test out the Tool

## Using in an Agent

There are 3 ways to configure the tool step when using in an agent

<Tabs>
  <Tab title="Using dropdown menus">
    This is the easiest way to configure the tool step. You can select the Drive, Spreadsheet and Worksheet from a list of options via the dropdown menu.

    <img src="https://mintcdn.com/relevanceai/fLFlffrslASJvpw0/images/gs-get-values-in-range-eg-1.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=b442b03efcc27ba6bfaa65076584ffb8" alt="Google Sheets Get Values in Range" width="2250" height="1110" data-path="images/gs-get-values-in-range-eg-1.png" />
  </Tab>

  <Tab title="Using input variables">
    This option offers the most flexibility - you can use the same tool step for multiple Google Sheets, however you will need to manually provide the necessary Google Sheet IDs.

    <img src="https://mintcdn.com/relevanceai/fLFlffrslASJvpw0/images/gs-get-values-in-range-eg-2.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=533a7353af32c2919a7e2d3718a98498" alt="Google Sheets Get Values in Range" width="2222" height="1138" data-path="images/gs-get-values-in-range-eg-2.png" />
  </Tab>

  <Tab title="Mix of dropdown menus and input variables">
    This option offers the best of both worlds. You can use the dropdown menu to select the Drive, Spreadsheet and Worksheet, and then use an input variable for "Range" to allow the agent to dynamically retrieve data to your Google sheet.

    <img src="https://mintcdn.com/relevanceai/fLFlffrslASJvpw0/images/gs-get-values-in-range-eg-3.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=a779fe5b6c5759c1467af842fbe510e3" alt="Google Sheets Get Values in Range" width="2226" height="1072" data-path="images/gs-get-values-in-range-eg-3.png" />
  </Tab>
</Tabs>

## Parameters

<ParamField path="Drive" type="string">
  The Drive you want to use. By default, the tool uses "My Drive".
</ParamField>

<ParamField path="Spreadsheet ID" type="string" required>
  To get the spreadsheet ID, navigate to your Google Sheet and copy the ID from the URL (the long string between `/d/` and `/edit`).
  <Tip> [You can use this tool to parse the worksheet, spreadsheet and drive IDs from a url](https://app.relevanceai.com/notebook/f1db6c/d64db999bc25-4ea0-b926-30b350f69243/01e4918b-6c0a-423d-8daa-a625ced25e23)</Tip>
</ParamField>

<ParamField path="Worksheet ID" type="string" required>
  To get the worksheet ID, open the specific worksheet you want to use and copy the ID from the URL (appears after `#gid=`).
  <Tip> [You can also use this tool to parse the worksheet, spreadsheet and drive IDs from a url](https://app.relevanceai.com/notebook/f1db6c/d64db999bc25-4ea0-b926-30b350f69243/01e4918b-6c0a-423d-8daa-a625ced25e23)</Tip>
</ParamField>

<ParamField path="Range" type="string">
  Specify the range of cells to retrieve, starting from the top-left cell to the bottom-right cell.

  <img src="https://mintcdn.com/relevanceai/fLFlffrslASJvpw0/images/gs-get-values-in-range-eg-4.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=1d889986d8188439f1446f02ba4215dc" alt="Google Sheets Add Single Row" width="400" data-path="images/gs-get-values-in-range-eg-4.png" />

  `A2:B3` will return a 2x2 block containing `Bella`, `Luna`, `Dog`, and `Cat`.
  <Note>Leave the "Range" field empty to retrieve the entire sheet.</Note>
</ParamField>

## Frequently asked questions (FAQs)

<AccordionGroup>
  <Accordion title="What is the difference between using the green input variables and the dropdown menu?">
    **The dropdown menu is the easiest way to configure the tool step**. You can select the Drive, Spreadsheet and Worksheet from a list of options via the dropdown menu.

    **The input variables offer more flexibility** e.g. you can use the same tool step for multiple Google Sheets, however you will need to manually provide the necessary Google Sheet IDs.
  </Accordion>

  <Accordion title="Can I use a mix of both dropdown menu and green input variables?">
    If you are using the tool in an agent, this is the recommended approach. You can use the dropdown menu to select the fields that don't need to change, and then use the green input variables for "Range" to allow the agent to dynamically retrieve data from your Google sheet.

    <Warning>If you are only using the input variables, you will need to provide the necessary Google Sheet IDs for the tool step to function properly. At the minimum, this includes the spreadsheet ID and the worksheet ID.</Warning>
  </Accordion>
</AccordionGroup>
