-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppScript.gs
63 lines (53 loc) · 2.12 KB
/
AppScript.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//function onEdit(e) {
// var ss = SpreadsheetApp.getActiveSpreadsheet();
// var sheet1 = ss.getSheets()[0];
// var subject = "Your MentorMatch!"
// var body = "x"
//
// var email_address = sheet1[0][1];
// ss.alert(email_address);
//}
//MailApp.onEdit(subject,body);
/**
* A special function that inserts a custom menu when the spreadsheet opens.
*/
function onOpen() {
var menu = [{name: 'Get Email', functionName: 'getEmail_'}];
SpreadsheetApp.getActive().addMenu('Print Email', menu);
var availbl = [{name: 'Parse Availab', functionName: 'parseLunchAvailability_'}];
SpreadsheetApp.getActive().addMenu('Parse availability', availbl);
}
function parseLunchAvailability_() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName('Sheet3');
var range = sheet.getDataRange();
var values = range.getValues();
for (var row = 2; row < values.length; row++) {
var range = sheet.getRange([row], 9);
if (values[row][8] != ""){
range.setValue(values[row][8] + ', lunchtime');
}
}
}
function getEmail_() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName('Form Responses 1');
var range = sheet.getDataRange();
var values = range.getValues();
//Browser.msgBox("data in cell " + values[1][1]);
//for (var row = 1; row < values.length; row++) {
//var email = values[row][1];
var email = "sam@thebughunter.com.au";
//Browser.msgBox("data in cell " + values[row][1]);
MailApp.sendEmail( email,
"You've Been Accepted Into MenorMatch!",
"Congratulations! You have been accepted as a mentor. \n\n We have set up a profile page for you, find it at https://bughuntersam.com/profile-page/ \nFeel free to edit your profile. \n\nRegards, \nMentorMatch"
//"Welcome to MentorMatch!",
//'Thanks for registering! \nKeep an eye on your emails we will match you with a mentoring group soon.\n\nRegards, \nMentorMatch '
);
//print each email
// for (var col =1; col < values.length; col++) {
//Browser.msgBox("data in cell " + values[row][col]);
//}
//}
}