-1

How to get my contacts to Google Sheets via sheet script without down-or uploading or importing exporting method.

getAddress() 

doesn't work for me

this is not an answer, but i have to, because the above box is too small for this matter.

function Importcontacts_2() { 
  var group  = ContactsApp.getContactGroup('family');  
  var contacts = group.getContacts();                     
  var ss = SpreadsheetApp.getActiveSpreadsheet();     
  var sheet = ss.getSheets()[0];                         
  sheet.appendRow(['Full Name', 'Email Address','Home Adress' ]);
  for (var i in contacts) 
      {
         var fullname=contacts[i].getFullName();    
         var emailid=contacts[i].getEmails();  
         var home_adress=contacts[i].getAddresses(ContactsApp.Field.HOME_ADDRESS);

         for(i in emailid)      
           {       
             sheet.appendRow([fullname, emailid[i].getAddress()]);// append contact data to active sheet           
           }  
        }        
}
  • Please add a minimal, complete and verifiable example (mcve). – Rubén Feb 6 at 19:39
  • I tested it, but i still get no filled home-adresses below HOME-ADRESS title – Royowski01 Feb 6 at 21:45
  • Have you already read developers.google.com/apps-script/guides/support/…? – Rubén Feb 6 at 23:48
  • Yes, i have read it about debugging.Now i have tried this :var homeAddress = contacts[i].getAddress(ContactsApp.Field.HOME_ADDRESS); and i still get the red bar message getAddress() undefined.Further i have changed getContactGroup('family') by getContactsByName('Karin Suister'); – Royowski01 Feb 7 at 14:12
  • function Importcontacts_3()//works fine for one person { var contacts = ContactsApp.getContactsByName('Karin Suister'); Logger.log(contacts); var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; sheet.appendRow(['Full Name', 'Address']);// Creating Header for (i in contacts) { var fullname=contacts[i].getFullName(); var homeAddress = contacts[i].getAddresses(ContactsApp.Field.HOME_ADDRESS); } sheet.appendRow([fullname,homeAddress[0].getAddress()]); } – Royowski01 Feb 7 at 15:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.