Categories
Code

Update Google Contacts with Google Apps Script

This Google Apps Script project will allow your existing contacts to update their Google Contacts entries using a simple online form. The HTML form is published using Apps Script’s HtmlService.


function go() {    
  
  var emailNAME     = ScriptProperties.getProperty("NAME");
  var googleGROUP   = ContactsApp.getContactGroup(
                          ScriptProperties.getProperty("GROUP"));
  
  if (googleGROUP) {
    
    var emailSUBJECT  = "Your contact information";    
    var myContacts = googleGROUP.getContacts();
    
    for (i=0; i
" + "Please click here and fill-in the required details." + "Your information will be directly added to my Google Contacts." + "

Thanks,
" + emailNAME; var emailTEXT = "Hi,\n\n" + "Would you please take a moment and update your contact information in my address book. \n\n" + ScriptApp.getService().getUrl() + "?" + Utilities.base64Encode(ID + "#" + email) + "\n\nJust click the URL, fill-in the form and your details will be directly added to my Google Contacts." + "\n\nThanks,\n" + emailNAME; GmailApp.sendEmail(email, emailSUBJECT, emailTEXT, {htmlBody:emailBody, name:emailNAME}); } } } function doGet() { var html = HtmlService.createTemplateFromFile("form").evaluate(); html.setTitle("Google Contacts - Digital Inspiration") return html; } function labnolGetContact(q) { var contact = {}; contact.FOUND = 0; try { var id = Utilities.base64Decode(q); var email = ""; for(var i = 0; i