Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Importcontacts() {
- var contacts = ContactsApp.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
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement