-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utils.gs
34 lines (34 loc) · 1.01 KB
/
Utils.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
var Utils = {
/**
* getColumValues
* 列の値を配列で取得する
**/
getColumValues: function(sheetName, columnName, startIndex) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(sheetName);
var values = sheet.getRange(columnName + ":" + columnName).getValues();
var result = new Array();
for (var i = 0; i < values.length; i++) {
if (i >= startIndex) {
if(values[i] != null && values[i] != "") {
result.push(values[i]);
}
}
}
return result;
},
// シートオブジェクトを取得する
getSheet: function(sheetName) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
return ss.getSheetByName(sheetName);
},
/**
* sendEmails
* メール送付
**/
sendEmails: function(recipients, subject, body) {
for each (var recipient in recipients) {
MailApp.sendEmail(recipient, subject, body);
}
}
};