I have the following code which creates Google Contacts from a Spreadsheet. The problem is whenever I run the code it creates contacts but has no functionality to check if the same Google Contact already exists or not.
Google Apps Script – Duplicate Check for Google Contacts
google sheetsgoogle-apps-scriptgoogle-contacts
Best Answer
This piece of code retrieves the contacts of the group first and checks whether an e-mail address corresponds to one of the sheet entries:
Code
Explained
The
groupContacts
retrieves all available contacts in the group. Thex=1
makes sure to skip the header and the array (aContact
) is created for easy access. If the group has no entries, thenc
will remain0
and the new contacts will be added. Then the script will itterate over the contacts and over the e-mails present. If a match is found,u
will be> 0
and no contact is added.Remark
Make sure the data you about to add contains no duplicates.....