質問編集履歴
4
本文中のコードの種類を追記。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
しかし検索していて見つけた[こちらの記事](http://uske-s.hatenablog.com/entry/2017/11/18/003151)の、
|
|
11
11
|
|
|
12
|
-
```
|
|
12
|
+
```javaScript
|
|
13
13
|
for (key in order) if (order[key]) temp += key + ":"+order[key]+"個\n";
|
|
14
14
|
```
|
|
15
15
|
|
3
解決
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
### 追記(2018/07/23 17:30)
|
|
46
|
+
### 追記(2018/07/23 17:30)(解決)
|
|
47
47
|
```javaScript
|
|
48
48
|
var ss = SpreadsheetApp.getActiveSpreadsheet();
|
|
49
49
|
var sheet = ss.getActiveSheet();
|
2
「追記」部分を修正。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -45,11 +45,12 @@
|
|
|
45
45
|
|
|
46
46
|
### 追記(2018/07/23 17:30)
|
|
47
47
|
```javaScript
|
|
48
|
-
function sendOrderMail() {
|
|
49
48
|
var ss = SpreadsheetApp.getActiveSpreadsheet();
|
|
50
49
|
var sheet = ss.getActiveSheet();
|
|
51
50
|
var lastLow = sheet.getLastRow();
|
|
52
51
|
var val = sheet.getRange(lastLow,1,1,6).getValues()[0];
|
|
52
|
+
|
|
53
|
+
function sendOrderMail() {
|
|
53
54
|
var order = {};
|
|
54
55
|
var temp = "";
|
|
55
56
|
|
1
「追記」部分を追記。
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -40,4 +40,44 @@
|
|
|
40
40
|
htmlBody:content //←pタグで挟んでもいい
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### 追記(2018/07/23 17:30)
|
|
47
|
+
```javaScript
|
|
48
|
+
function sendOrderMail() {
|
|
49
|
+
var ss = SpreadsheetApp.getActiveSpreadsheet();
|
|
50
|
+
var sheet = ss.getActiveSheet();
|
|
51
|
+
var lastLow = sheet.getLastRow();
|
|
52
|
+
var val = sheet.getRange(lastLow,1,1,6).getValues()[0];
|
|
53
|
+
var order = {};
|
|
54
|
+
var temp = "";
|
|
55
|
+
|
|
56
|
+
if (val[3]!=''){
|
|
57
|
+
var dAddress = "***";
|
|
58
|
+
var subject = "***";
|
|
59
|
+
var content = "名前:"+val[1]+"\n";
|
|
60
|
+
|
|
61
|
+
order['メール'] = val[4];
|
|
62
|
+
order['URL'] = val[5];
|
|
63
|
+
|
|
64
|
+
for (key in order){
|
|
65
|
+
if (order[key]){
|
|
66
|
+
temp += key + ":"+order[key]+"\n";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
Logger.log(temp)
|
|
70
|
+
|
|
71
|
+
content += temp;
|
|
72
|
+
content += Utilities.formatDate(val[0],'JST','yyyy年M月d日 H時m分')+"\n";
|
|
73
|
+
content += "**********************\n"+val[3];
|
|
74
|
+
// メール通知する
|
|
75
|
+
content = content.replace(/\n/g,'<br>'); //必要があれば改行コードを<br>に差し替え
|
|
76
|
+
MailApp.sendEmail({
|
|
77
|
+
to :dAddress,
|
|
78
|
+
subject :subject,
|
|
79
|
+
htmlBody:content //←pタグで挟んでもいい
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
43
83
|
```
|