我正在尝试从 Google 表单创建电子邮件分发列表。然后我想将这些人放在一个特定的联系人组中。这是我到目前为止编译的代码。请帮忙。先感谢您。
function addContact() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 3;
var numRows = 10; // I want the rows to be infinite
var dataRange = sheet.getRange(startRow, 2, numRows, 10)
var data = dataRange.getValues();
for (i in data) {
var row = data[i];
var firstName = row[1];
var lastName = row[2];
var emailAdd = row[3];
}
// The code below creates a new contact and adds it to the "Work Friends" contact group
var contact = ContactsApp.createContact(firstName, lastName, emailAdd);
var group = ContactsApp.getContactGroup('Work Friends');
group.addContact(contact);
}