回答編集履歴

5

 

2022/04/08 03:33

投稿

退会済みユーザー
test CHANGED
@@ -20,8 +20,7 @@
20
20
  var answer = itemResponse.getResponse();
21
21
 
22
22
  if (type === FormApp.ItemType.FILE_UPLOAD) {
23
- if (!Array.isArray(answer)) answer = [answer];
24
- attachImg = attachImg.concat(answer.map(e => DriveApp.getFileById(e).getBlob()));
23
+ attachImg = [...attachImg, ...[...answer].map(e => DriveApp.getFileById(e).getBlob())];
25
24
  }
26
25
 
27
26
  // 回答項目

4

 

2022/04/08 00:37

投稿

退会済みユーザー
test CHANGED
@@ -19,7 +19,7 @@
19
19
  var question = itemResponse.getItem().getTitle();
20
20
  var answer = itemResponse.getResponse();
21
21
 
22
- if (type == FormApp.ItemType.FILE_UPLOAD) {
22
+ if (type === FormApp.ItemType.FILE_UPLOAD) {
23
23
  if (!Array.isArray(answer)) answer = [answer];
24
24
  attachImg = attachImg.concat(answer.map(e => DriveApp.getFileById(e).getBlob()));
25
25
  }

3

修正

2022/04/07 23:52

投稿

退会済みユーザー
test CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  if (type == FormApp.ItemType.FILE_UPLOAD) {
23
23
  if (!Array.isArray(answer)) answer = [answer];
24
- attachImg = answer.map(e => DriveApp.getFileById(e).getBlob());
24
+ attachImg = attachImg.concat(answer.map(e => DriveApp.getFileById(e).getBlob()));
25
25
  }
26
26
 
27
27
  // 回答項目

2

複数ファイルに対応

2022/04/07 11:45

投稿

退会済みユーザー
test CHANGED
@@ -20,8 +20,9 @@
20
20
  var answer = itemResponse.getResponse();
21
21
 
22
22
  if (type == FormApp.ItemType.FILE_UPLOAD) {
23
+ if (!Array.isArray(answer)) answer = [answer];
23
- attachImg.push(DriveApp.getFileById(answer).getBlob());
24
+ attachImg = answer.map(e => DriveApp.getFileById(e).getBlob());
24
- }
25
+ }
25
26
 
26
27
  // 回答項目
27
28
  body += "\n\n【" + question + "】\n\n";

1

 

2022/04/06 22:14

投稿

退会済みユーザー
test CHANGED
@@ -1,3 +1,4 @@
1
+ 下記ではいかがでしょうか。
1
2
  ```js
2
3
  function sendForm(e) {
3
4