Google Sheets — Find cell
Google Sheets — Find cell
Section titled “Google Sheets — Find cell”Type: googlesheets-find-cell · Package: Google Sheets Activities v1.0.5 · Output: Dictionary<string,object>
Searches the sheet for a value and returns the location of the first matching cell. It is Google Sheets’ “Find” from the robot: locate a label (“Total”), a code or a marker to read or write next to it.
How it works
Section titled “How it works”Reads the sheet sheet (the first one if empty), or only the given range, and goes through the cells row by row, left to right, comparing their text with value according to match-type. Returns the first match.
- The comparison is case-insensitive and uses the text displayed in the cell (a number formatted as
1,500is compared as"1,500"). rowandcolumnare absolute in the sheet, even when you search arangethat does not start atA1.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
value | object | — | Value to find; compared as text. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGoogleSheetsSession | — | Session from Google Sheets — Open. Inside Open’s body it is inherited and you can leave it empty. |
sheet | string | — | Sheet to search. If empty, the first sheet is used. |
range | string | — | Limits the search to a range in A1 notation (e.g. A1:Z100). Default: the whole sheet. |
match-type | string | exact | Comparison: exact (cell equals the value), contains (cell contains the value) or starts-with (cell starts with the value). |
Output
Section titled “Output”Returns a Dictionary with the first match, or null if there is none (or the sheet is empty):
| Key | Type | Content |
|---|---|---|
address | string | A1 address of the cell, e.g. C7. |
row | int | Row number (1 = first row of the sheet). |
column | int | Column number (1 = column A). |
value | string | Full text of the matching cell. |
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'value' is required. | value is empty or its expression returned null. |
No Google Sheets session available. Provide 'session' from a googlesheets-open activity, or place this activity inside the Open activity's body … | The activity is outside Open’s body and received no session. Move it inside the body or pass the saved session. |
The spreadsheet has no sheets to read. | sheet and range are empty and the document has no sheets. |
The service sheets has thrown an exception. HttpStatusCode is … | Google rejected the call: missing sheet or range, no access, expired token or quota exceeded. See Google API errors. |
Not finding the value is not an error: the output is null.
Example
Section titled “Example”Find a code and mark its row as processed in column F:
Google Sheets — Find cell session = book sheet = "Orders" value = code → output: cellIf condition = !isNull(cell) └─ then: Google Sheets — Write cell session = book sheet = "Orders" cell = "F" + cell["row"] value = "Processed" Log message = "Code found at " + cell["address"]