質問編集履歴
9
画像の追加(44行目までデバックを実行したときの変数の値)
test
CHANGED
File without changes
|
test
CHANGED
@@ -129,3 +129,9 @@
|
|
129
129
|
2020年5月4日朝7時前の状況を添付します。(変数の値)
|
130
130
|
|
131
131
|
![イメージ説明](3ba83e64da81bc0c654124557ac5477f.png)
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
2020年5月4日午後5時の状況を添付します。(変数の値)(同じコードで44行目までデバックしました)
|
136
|
+
|
137
|
+
![イメージ説明](72a3e1cdefd626d90a9d8aef72fb1248.png))
|
8
デバック状況を添付(変数の値)
test
CHANGED
File without changes
|
test
CHANGED
@@ -125,3 +125,7 @@
|
|
125
125
|
}
|
126
126
|
|
127
127
|
```
|
128
|
+
|
129
|
+
2020年5月4日朝7時前の状況を添付します。(変数の値)
|
130
|
+
|
131
|
+
![イメージ説明](3ba83e64da81bc0c654124557ac5477f.png)
|
7
コード間違い修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
mymsg[i][3] = msgs[i][j].getPlainBody().replace(/<("[^"]*"|'[^']*'|[^'">])*>|nbsp/g,'').replace(/&; | /g,'').substring(0,50000);
|
96
96
|
|
97
|
-
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','Name')
|
97
|
+
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','Name');
|
98
98
|
|
99
99
|
}
|
100
100
|
|
6
コード削除:mySheet.appendRow([
test
CHANGED
File without changes
|
test
CHANGED
@@ -94,13 +94,7 @@
|
|
94
94
|
|
95
95
|
mymsg[i][3] = msgs[i][j].getPlainBody().replace(/<("[^"]*"|'[^']*'|[^'">])*>|nbsp/g,'').replace(/&; | /g,'').substring(0,50000);
|
96
96
|
|
97
|
-
mySheet.appendRow([
|
98
|
-
|
99
|
-
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','Name
|
97
|
+
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','Name'),
|
100
|
-
|
101
|
-
id
|
102
|
-
|
103
|
-
]);
|
104
98
|
|
105
99
|
}
|
106
100
|
|
5
コード修正:mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','Name:'),
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,7 +96,7 @@
|
|
96
96
|
|
97
97
|
mySheet.appendRow([
|
98
98
|
|
99
|
-
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments','
|
99
|
+
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','Name:'),
|
100
100
|
|
101
101
|
id
|
102
102
|
|
4
コード修正:var mysheetname = 'Gmail解析_' + Utilities.formatDate(new Date(), 'JST', 'yyyyMMddHHmmss');
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
var rowNumber = 2;
|
34
34
|
|
35
|
-
var mysheetname = 'Gmail解析_' +
|
35
|
+
var mysheetname = 'Gmail解析_' + Utilities.formatDate(new Date(), 'JST', 'yyyyMMddHHmmss');
|
36
36
|
|
37
37
|
|
38
38
|
|
@@ -96,7 +96,7 @@
|
|
96
96
|
|
97
97
|
mySheet.appendRow([
|
98
98
|
|
99
|
-
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments
|
99
|
+
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments','\r'),
|
100
100
|
|
101
101
|
id
|
102
102
|
|
@@ -113,24 +113,6 @@
|
|
113
113
|
}
|
114
114
|
|
115
115
|
}
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
var date = Utilities.formatdate(date,'JST',"yyyy'年'MM'月'dd'日' HH'時'mm'分'ss'秒'"){
|
120
|
-
|
121
|
-
return date.getFullYear().toString()
|
122
|
-
|
123
|
-
+ date.getMonth().toString()
|
124
|
-
|
125
|
-
+ date.getDate().toString()
|
126
|
-
|
127
|
-
+ date.getHours().toString()
|
128
|
-
|
129
|
-
+ date.getMinutes().toString()
|
130
|
-
|
131
|
-
+ date.getSeconds().toString();
|
132
|
-
|
133
|
-
};
|
134
116
|
|
135
117
|
|
136
118
|
|
3
コード修正:mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','\r'),
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,7 +96,7 @@
|
|
96
96
|
|
97
97
|
mySheet.appendRow([
|
98
98
|
|
99
|
-
mymsg[i][4] = fetchData(mymsg[i][3],'Appointment:','\r'),
|
99
|
+
mymsg[i][4] = fetchData(mymsg[i][3],'Appointments:','\r'),
|
100
100
|
|
101
101
|
id
|
102
102
|
|
2
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,7 +64,7 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
var searchQuery = 'subject:(”予約が確定" OR "finalized) ';
|
67
|
+
var searchQuery = 'subject:(”予約が確定" OR "finalized") ';
|
68
68
|
|
69
69
|
var threads = GmailApp.search(searchQuery, 0, 200);
|
70
70
|
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
mymsg[i][3] = msgs[i][j].getPlainBody().replace(/<("[^"]*"|'[^']*'|[^'">])*>|nbsp/g,'').replace(/&; | /g,'').substring(0,50000);
|
96
96
|
|
97
|
-
|
97
|
+
mySheet.appendRow([
|
98
98
|
|
99
99
|
mymsg[i][4] = fetchData(mymsg[i][3],'Appointment:','\r'),
|
100
100
|
|
@@ -102,13 +102,13 @@
|
|
102
102
|
|
103
103
|
]);
|
104
104
|
|
105
|
-
}
|
105
|
+
}
|
106
106
|
|
107
107
|
}
|
108
108
|
|
109
109
|
if(mymsg.length>0){
|
110
110
|
|
111
|
-
GmailSS.getSheets()[0].getRange(2, 1, i,
|
111
|
+
GmailSS.getSheets()[0].getRange(2, 1, i, 4).setValues(mymsg); //シートに貼り付け
|
112
112
|
|
113
113
|
}
|
114
114
|
|
@@ -116,7 +116,7 @@
|
|
116
116
|
|
117
117
|
|
118
118
|
|
119
|
-
|
119
|
+
var date = Utilities.formatdate(date,'JST',"yyyy'年'MM'月'dd'日' HH'時'mm'分'ss'秒'"){
|
120
120
|
|
121
121
|
return date.getFullYear().toString()
|
122
122
|
|
1
コード修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,7 +64,7 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
var searchQuery = 'subject:(”予約が確定" OR "finalized
|
67
|
+
var searchQuery = 'subject:(”予約が確定" OR "finalized) ';
|
68
68
|
|
69
69
|
var threads = GmailApp.search(searchQuery, 0, 200);
|
70
70
|
|
@@ -75,12 +75,6 @@
|
|
75
75
|
|
76
76
|
|
77
77
|
var msgs = GmailApp.getMessagesForThreads(threads);
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
78
|
|
85
79
|
|
86
80
|
|
@@ -100,7 +94,13 @@
|
|
100
94
|
|
101
95
|
mymsg[i][3] = msgs[i][j].getPlainBody().replace(/<("[^"]*"|'[^']*'|[^'">])*>|nbsp/g,'').replace(/&; | /g,'').substring(0,50000);
|
102
96
|
|
97
|
+
sheet.appendRow([
|
98
|
+
|
103
|
-
mymsg[i][4] = fetchData(msg
|
99
|
+
mymsg[i][4] = fetchData(mymsg[i][3],'Appointment:','\r'),
|
100
|
+
|
101
|
+
id
|
102
|
+
|
103
|
+
]);
|
104
104
|
|
105
105
|
}
|
106
106
|
|
@@ -108,7 +108,7 @@
|
|
108
108
|
|
109
109
|
if(mymsg.length>0){
|
110
110
|
|
111
|
-
GmailSS.getSheets()[0].getRange(2, 1, i,
|
111
|
+
GmailSS.getSheets()[0].getRange(2, 1, i, 7).setValues(mymsg); //シートに貼り付け
|
112
112
|
|
113
113
|
}
|
114
114
|
|
@@ -132,4 +132,20 @@
|
|
132
132
|
|
133
133
|
};
|
134
134
|
|
135
|
+
|
136
|
+
|
137
|
+
function fetchData(str, pre, suf) {
|
138
|
+
|
139
|
+
var reg = new RegExp(pre + '.*?' + suf);
|
140
|
+
|
141
|
+
var data = str.match(reg)[0]
|
142
|
+
|
143
|
+
.replace(pre, '')
|
144
|
+
|
145
|
+
.replace(suf, '');
|
146
|
+
|
147
|
+
return data;
|
148
|
+
|
149
|
+
}
|
150
|
+
|
135
151
|
```
|