There are times where Google Sheets is the second application in your integration, and you'd like the data in them to be in synced with no duplication. To do so, you'll be required to :
1) Make sure that the existing row already exists. If it does, update it.
2) If the existing row doesn't exist, add new row.
To update an existing row, we need to do a search. We can use Searching for existing row by query action, as shown below. In this example, we are searching in the spreadsheet "All sent mails", The column we are searching under is User Email, and the query we are using is the "Email" pill from a previous step
Note the query format. The right syntax is:
a) Column name in small letters without spacing (in this case, "User email" becomes "useremail")
b) Data pill in between two apostrophes when using a string ie. "[pill]", or without the apostrophes if using a number pill/text
And as stated, if there's more than 100 rows that matches the query, only the first 100 will be returned.
Subsequently, you will need to create a 'Update Row' action for Google Sheets, and use the Row ID from the search step's output to update the row. If you are expecting multiple results from the search and you need to update all the rows, you will need to use a repeat action. You can find out more about repeat actions here.
Updating a Row from the Trigger action
There are times that you'd like to update a spreadsheet row that has been picked up from the trigger. Maybe you'd like to add in information from your Salesforce to auto populate your spreadsheet, or maybe you'd just need to change any faulty information. You can do so by updating the row from the spreadsheet. However, do remember, the update row only takes a Row ID from the search query step, and NOT the trigger step.
This is one of the examples that will throw an error. You may have attempted to put in an ID coming from a trigger to use in the Update row action. Unfortunately that is not the right ID to be used. a Row ID is only available from the output of a search by query :
To do this, you can do a specific search to the row picked up by the trigger by putting in the same value in the search query
Now, you will be able to use the output of this step for update row step. AS you can see, the name of the pill should be 'Row ID' and not just 'ID'
Note: For the columns to be displayed in the action to update a row, you would need to ensure there is at least one row of data apart from the headers.