I want to track my Google Contacts. When a new contact is added or an existing one is edited, I want to copy the contact ID, given name, last name, and email address into a Google Sheet. However, it should only create a new row in the sheet when a new contact is created in Contacts. When I update a contact in Contacts, it should update the corresponding entry in the sheet.
What is the problem?
It doesnât update the existing rows. If something is changed, it adds a new row with the information. I tried using an aggregator or iterator; however, this is quite confusing for me as a non-native speaker.
What have you tried so far?
Tried with an aggregator or iterator. Bulk Update Rows (Did not even got this module to work(I get following error code: BundleValidationError
Validation failed for 1 parameter(s).
Invalid collection in parameter ârowsâ.))
Youâre almost there. The reason youâre getting new rows is that the scenario never checks whether the contact already exists in the sheet.
What you want to do is search the Google Sheet using the Contact ID before writing anything. That Contact ID should be your unique key. If the search finds a row, just update that row. If it doesnât find anything, then create a new row.
You donât need an aggregator or iterator for this, which is why it felt confusing. Theyâre not really meant for this use case. Also, you can skip âBulk Update Rowsâ and just use a simple âUpdate a rowâ module once you have the row ID.
After that, edits in Google Contacts will update the existing row instead of creating duplicates.
First of all thank you for the very quick Feedback :).
I have played around with it till now and atleast all the inputs now work. However once i Update an already existing Contact i have following problem: The issue occurs because the router condition is evaluated for every row in the Google Sheet. Even if one row matches the contact ID and triggers an update, all other rows do not match and therefore trigger the âadd new rowâ path. As a result, the contact is always added again, causing duplicate entries instead of a single update.
Which I understood with the help of ChatGPT, however how do I fix this now. In the easiest and if possible most credit friendly way possible.
I spent some time doing the Academy, however I wanted to tried something hands on. This is why I started with this Scenario. I will definetly continue with the Academy.