# Google Sheets action - Update row
This action allows you to update a row in a sheet. It is often used together with action Search rows, so you will first search for the rows you want then update them.
# How to use it
The following example will demonstrate how to use the Update row
action in conjunction with Search rows
.
Our sample sheet is a list of items from different countries. For Google Sheets connector to work, the sheet needs to have at least 1 header row and 1 data row.
We realize there is an error in rows 3 & 4: Region
of "Australia" should be "Australia and Oceania", not "Asia". Let's use the following Workato recipe to correct that. It will search for rows with Country
= "Australia" and Region
= "Asia", then update the Region
to "Australia and Oceania" instead.
This is how we setup the Search & Update actions:
Step 1 - Search rows: We set
Region
= "Asia" andCountry
= "Australia". The action will search for rows matching those conditions.Step 2 - Repeat action: Loop through the rows from
Search rows
result, using theRows
data pill.Step 3 - Update row: Use
Row number
data pill from theForeach
loop to tell the action which row to update. We set the newRegion
value to "Australia and Oceania".
After we run the recipe, rows 3 & 4 are correctly updated:
# Input
Input field | Description |
---|---|
Spreadsheet | You can either select a spreadsheet from the dropdown, or use Spreadsheet ID data pill from the output of other Google Sheets triggers & actions. |
Sheet | You can either select a sheet from the dropdown, or use Sheet name data pill from the output of other Google Sheets triggers & actions. |
Row number | Indicate which row you want to update. |
Columns | After you select a spreadsheet, a sheet and a row in the sheet, the columns in that row will be displayed here. Enter the new values for Workato to update those columns. For example, in the screenshot above, Workato will update the selected row with new values: Region = "Europe" AND Country = "Sweden" AND Item = "Car" |
# Output
Output pill | Description |
---|---|
Spreadsheet ID | ID of the spreadsheet. You can map this into Spreadsheet input field of other Google Sheets actions, instead of selecting the spreadsheet from the dropdown. |
Spreadsheet name | Name of the spreadsheet. |
Sheet name | Name of the sheet. You can map this into Sheet input field of other Google Sheets actions, instead of selecting the sheet from the dropdown. |
Updated range | The range in the sheet that this action have updated. |
Updated columns count | The number of columns this action has updated. |
Columns | This contains the values of all updated columns in the selected row. |
Last updated: 4/5/2023, 11:28:53 AM