> ## 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.

# Update Multiple Rows

> The Update Multiple Rows tool step allows you to update multiple rows in your Google Sheet

## Add the ‘Update Multiple Rows’ Tool step to your Tool

<div
  style={{
position: "relative",
boxSizing: "content-box",
maxHeight: "100vh",
width: "100%",
aspectRatio: "1.7431192660550459",
padding: "24px 0"
}}
>
  <iframe
    src="https://app.supademo.com/embed/cmego9gny884xh3pyme82l1vx?embed_v=2&utm_source=embed"
    loading="lazy"
    title="Google Sheets Update Multiple Rows"
    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 ‘Update Multiple Rows’ Tool step to your Tool by:

1. Creating a new Tool, then searching for the ‘Update Multiple Rows’ 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 update rows in.
   * Select the worksheet you would like to update rows in.
4. Enter the range you would like to update. This should be in the format of `A1:C5`.
5. Enter the new Row Values. This should be an array of arrays.
   <Note>Example: `[["John Doe", "john.doe@example.com", "123 Main St"], ["Jane Doe", "jane.doe@example.com", "456 Main St"]]`</Note>
6. 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-update-multiple-rows-eg-1.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=63a7619d4f2a13e86da1ffc38297a925" alt="Google Sheets Update multiple rows" width="739" height="886" data-path="images/gs-update-multiple-rows-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-update-multiple-rows-eg-2.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=77f9cbac515fc028206eac306842e3de" alt="Google Sheets Update multiple rows" width="737" height="715" data-path="images/gs-update-multiple-rows-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" and "Row Values" to allow the agent to dynamically update data in your Google sheet.

    <img src="https://mintcdn.com/relevanceai/fLFlffrslASJvpw0/images/gs-update-multiple-rows-eg-3.png?fit=max&auto=format&n=fLFlffrslASJvpw0&q=85&s=7ee3be8a85d53e5924d6fcc20909f96d" alt="Google Sheets Update multiple rows" width="738" height="689" data-path="images/gs-update-multiple-rows-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" required>
  The range of cells to update. The update will begin at the starting cell of the range (e.g., if the range is `A10:C20`, updates begin at `A10`).

  <Warning>
    Make sure the specified range fully covers the rows and columns you are updating.\
    For example, if you are updating 3 columns across the first 5 rows, the range should be at least `A1:C5`.
  </Warning>
</ParamField>

<ParamField path="Row Values" type="array of arrays" required>
  The data being updated will need to be in an array of arrays format.

  **Example:**

  ```json theme={null}
  [
    ["John Doe", "john.doe@example.com", "123 Main St"], // row 1
    ["Jane Doe", "jane.doe@example.com", "456 Main St"] // row 2
    // ...
  ]
  ```
</ParamField>

## What is an array of arrays?

An array is a data structure similar to a CSV row, where each element is separated by a comma, and the entire row is enclosed in square brackets.
An array can have many different types of data, including strings, numbers, <Tooltip tip="true or false">booleans</Tooltip>, and even other arrays.

```json theme={null}
["Dog", 1, true]
```

An array of arrays is just multiple arrays put together. This is what an array of arrays looks like:

```json theme={null}
[
  ["Column 1 Row 1", "Column 2 Row 1", "Column 3 Row 1"],
  ["Column 1 Row 2", "Column 2 Row 2", "Column 3 Row 2"],
  ["Column 1 Row 3", "Column 2 Row 3", "Column 3 Row 3"]
]
```

When you combine multiple arrays together, you can see that the data is structured like a Google Sheet.

### Playground

<div
  style={{
position: "relative",
width: "100%",
height: "50vh",
minHeight:"300px",
border: "3px solid #5E43CE",
borderRadius: "10px",
}}
>
  <iframe
    src="https://app.relevanceai.com/form/f1db6c/89c69a15-1042-4524-886e-cca4e5a0dddb?version=latest&hideLogo=true&guidanceTipText=%F0%9F%91%86+Use+this+tool+to+help+you+understand+what+an+array+of+arrays+is"
    style={{ 
width: "100%", 
height: "100%",
border: "none",
}}
  />
</div>

## 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 (the ID fields), and then use the green input variables for "Range" and "Row Values" to allow the agent to dynamically update data in 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>
