-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code.gs
46 lines (43 loc) · 1.2 KB
/
Code.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function onFormSubmit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var lastRow = sheet.getLastRow();
var givenName = sheet.getRange(lastRow, 2, 1, 1).getValue(); //Column having First Name
var familyName = sheet.getRange(lastRow, 3, 1, 1).getValue(); //Column having Last Name
var email = sheet.getRange(lastRow, 4, 1, 1).getValue(); //Column having Email
var address = sheet.getRange(lastRow, 5, 1, 1).getValue(); //Column having Address
var phone = sheet.getRange(lastRow, 6, 1, 1).getValue(); //Column having Phone number
var bibliography = sheet.getRange(lastRow, 7, 1, 1).getValue(); //Column having Comments
var contactStructure = {
names: [
{
givenName: givenName,
familyName: familyName,
},
],
emailAddresses: [
{
//"type": "work",
value: email,
},
],
phoneNumbers: [
{
//"type": "home",
value: phone,
},
],
addresses: [
{
//"type": "home",
formattedValue: address,
},
],
biographies: [
{
value: bibliography,
},
],
};
createContact = People.People.createContact(contactStructure);
}