回答編集履歴

1

コメントを反映

2019/11/17 17:57

投稿

draq
draq

スコア2573

test CHANGED
@@ -3,6 +3,10 @@
3
3
 
4
4
 
5
5
  詳しくは公式ドキュメントの [HTML Service: Templated HTML -> Pushing variables to templates](https://developers.google.com/apps-script/guides/html/templates#pushing_variables_to_templates) をどうぞ。
6
+
7
+
8
+
9
+ (2019/11/18 コメントの内容をサンプルソースへ反映しました。)
6
10
 
7
11
 
8
12
 
@@ -24,6 +28,16 @@
24
28
 
25
29
  }
26
30
 
31
+
32
+
33
+ //テンプレートからパラメータを引数として受け取る
34
+
35
+ function getData(mydata) {
36
+
37
+ return "getData()の引数は" + mydata + "です。";
38
+
39
+ }
40
+
27
41
  ```
28
42
 
29
43
  - index.html
@@ -42,7 +56,9 @@
42
56
 
43
57
  <body>
44
58
 
59
+ <!-- テンプレートで渡されたパラメータをgetData()の引数として渡す -->
60
+
45
- <?= mydata ?>
61
+ <?= getData(mydata) ?>
46
62
 
47
63
  </body>
48
64