質問編集履歴
1
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,12 +16,50 @@
|
|
16
16
|
|
17
17
|
```GAS
|
18
18
|
|
19
|
-
|
19
|
+
function myFunction(){
|
20
20
|
|
21
|
+
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
|
22
|
+
|
21
|
-
var e
|
23
|
+
var sheet = spreadsheet.getSheetByName("sheet1"); // シートの取得
|
24
|
+
|
25
|
+
var firstRow = sheet.getRange(3,6).getValues();//最終行の確認
|
26
|
+
|
27
|
+
var eventdate = sheet.getRange("A1").getValue();
|
22
28
|
|
23
29
|
|
24
30
|
|
25
|
-
var threads = GmailApp.search('subject:●●● cc:●●●@●●●.com after:eventdate
|
31
|
+
var threads = GmailApp.search('subject:●●● cc:●●●@●●●.com after:${eventdate}'); // 検索条件指定
|
32
|
+
|
33
|
+
var messages = GmailApp.getMessagesForThreads(threads);
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
//書き込み
|
38
|
+
|
39
|
+
messages.forEach(function(message){
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
var Subject = message[0].getSubject();
|
44
|
+
|
45
|
+
var date = message[0].getDate();
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
var data = [date,Subject];
|
50
|
+
|
51
|
+
sheet.getRange(firstRow,1,1,data.length).setValues([data]);
|
52
|
+
|
53
|
+
Logger.log([data]); //確認用
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
firstRow++;
|
58
|
+
|
59
|
+
});
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
}
|
26
64
|
|
27
65
|
```
|