質問編集履歴

3

html部分訂正

2020/07/31 06:45

投稿

mmyk
mmyk

スコア2

test CHANGED
File without changes
test CHANGED
@@ -102,33 +102,15 @@
102
102
 
103
103
  <script type='text/javascript'>
104
104
 
105
- window.onload = function(){
106
-
107
- handleDownload();
108
-
109
- }
110
-
111
105
  function handleDownload() {
112
106
 
113
- // 出力データを GAS から取得する
107
+ var content = <?= getData(); ?>; // 出力データを GAS から取得する
114
108
 
115
- var content = <?= getData(); ?>;
109
+ var bom = new Uint8Array([0xEF, 0xBB, 0xBF]);
116
110
 
117
- var blob = new Blob([ content ], { "type" : "text/csv"});
111
+ var blob = new Blob([ bom, content ], { "type" : "text/csv"});
118
112
 
119
- var link = document.createElement('a');
120
-
121
- // ファイル名を GAS から取得する
122
-
123
- link.download = <?= getFileName(); ?>;
124
-
125
- link.href = window.URL.createObjectURL(blob);
113
+ document.getElementById("download").href = window.URL.createObjectURL(blob);
126
-
127
- link.click();
128
-
129
- // ダイアログを閉じる
130
-
131
- google.script.host.close();
132
114
 
133
115
  }
134
116
 
@@ -136,4 +118,8 @@
136
118
 
137
119
  </head>
138
120
 
121
+ <body>
122
+
123
+ <a id="download" href="#" download="test.csv" onclick="handleDownload()">ダウンロード</a>
124
+
139
- </html>
125
+ </body>

2

訂正

2020/07/31 06:45

投稿

mmyk
mmyk

スコア2

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  body,
16
16
 
17
- C1 = iframe {border: 0; display: block; height: 100%; margin: 0; padding: 0; width: 100%;}iframe#userHtmlFrame {overflow-y: scroll; -webkit-overflow-scrolling: touch;}</style><meta name="chromevox" content-script="no"><script type="text/javascript" src="/static/macros/client/js/1470202862-mae_html_user_bin_i18n_mae_html_user__ja.js" nonce="####"></script><script nonce="####">maeInit_( true );</script><iframe id="userHtmlFrame" allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; speake *; usb *; vibrate *; vr *" src="/blank"></iframe><form id="example_form"></form>
17
+ iframe {border: 0; display: block; height: 100%; margin: 0; padding: 0; width: 100%;}iframe#userHtmlFrame {overflow-y: scroll; -webkit-overflow-scrolling: touch;}</style><meta name="chromevox" content-script="no"><script type="text/javascript" src="/static/macros/client/js/1470202862-mae_html_user_bin_i18n_mae_html_user__ja.js" nonce="####"></script><script nonce="####">maeInit_( true );</script><iframe id="userHtmlFrame" allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; speake *; usb *; vibrate *; vr *" src="/blank"></iframe><form id="example_form"></form>
18
18
 
19
19
 
20
20
 

1

csvデータの例を追加しました。

2020/07/25 02:26

投稿

mmyk
mmyk

スコア2

test CHANGED
File without changes
test CHANGED
@@ -10,13 +10,17 @@
10
10
 
11
11
 
12
12
 
13
- <!doctype html><style nonce="####">html
13
+ <!doctype html><style nonce="####">html,
14
14
 
15
- body
15
+ body,
16
16
 
17
- iframe {border: 0; display: block; height: 100%; margin: 0; padding: 0; width: 100%;}iframe#userHtmlFrame {overflow-y: scroll; -webkit-overflow-scrolling: touch;}</style><meta name="chromevox" content-script="no"><script type="text/javascript" src="/static/macros/client/js/1470202862-mae_html_user_bin_i18n_mae_html_user__ja.js" nonce="####"></script><script nonce="####">maeInit_( true );</script><iframe id="userHtmlFrame" allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; speake *; usb *; vibrate *; vr *" src="/blank"></iframe><form id="example_form"></form>
17
+ C1 = iframe {border: 0; display: block; height: 100%; margin: 0; padding: 0; width: 100%;}iframe#userHtmlFrame {overflow-y: scroll; -webkit-overflow-scrolling: touch;}</style><meta name="chromevox" content-script="no"><script type="text/javascript" src="/static/macros/client/js/1470202862-mae_html_user_bin_i18n_mae_html_user__ja.js" nonce="####"></script><script nonce="####">maeInit_( true );</script><iframe id="userHtmlFrame" allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; speake *; usb *; vibrate *; vr *" src="/blank"></iframe><form id="example_form"></form>
18
18
 
19
19
 
20
+
21
+ 一度目の実行では以下のように抽出した項目がCSVで保存できました。
22
+
23
+ 1000,###@###.com,氏名,番号,フルーツシリーズ,レモンはトッピング選べます
20
24
 
21
25
 
22
26