title: How to get a script to import Google Contacts to Google Sheets?
body: <p>I would like to get a script to import all my contacts from Google Contacts to Google Sheets.</p>
  <p>I found one online, but it gives me the error &quot;TypeError: Cannot read property 'getContacts' of null (line 4, arquivo &quot;Código&quot;)&quot;</p>
  <p>What can I try next?</p>
  <pre><code>{ 
    var group  = ContactsApp.getContactGroup('* myContacts'); // Fetches group by groupname 
    var contacts = group.getContacts();                    // Fetches contact list of group 
    var ss = SpreadsheetApp.getActiveSpreadsheet();        //Get currently Active sheets 
    var sheet = ss.getSheets()[0];                         //Get first from active sheets list 
    sheet.appendRow(['Full Name', 'Email Address']);// Creating Header
    for (var i in contacts) 
        {
           var fullname=contacts[i].getFullName();    // gets full name of contact 
           var emailid=contacts[i].getEmails();                     //get emailid of contact 
           for(i in emailid) 
             { 
        sheet.appendRow([fullname, emailid[i].getAddress()]);// append contact data to active sheet 
             } 
         } 
  }``` 
  </code></pre>