回答編集履歴

3

2021/12/05 10:46

投稿

退会済みユーザー
test CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  const sourceRange = workingSheet.getRange(sourceA1);
22
22
 
23
- const keyColours = (sourceRange.getFontColor(), sourceRange.getBackground());
23
+ const keyColour = (sourceRange.getFontColor(), sourceRange.getBackground());
24
24
 
25
25
  const designatedValue = sourceRange.getValue();
26
26
 
@@ -28,11 +28,9 @@
28
28
 
29
29
  const targetColours = (targetRange.getFontColors(), targetRange.getBackgrounds());
30
30
 
31
-
32
-
33
31
  const targetValues = targetRange.getValues();
34
32
 
35
- targetRange.setValues(targetValues.map((r, i) => r.map((c, j) => targetColours[i][j] === keyColours && c !== '' ? designatedValue : c)));
33
+ targetRange.setValues(targetValues.map((r, i) => r.map((c, j) => targetColours[i][j] === keyColour && c !== '' ? designatedValue : c)));
36
34
 
37
35
 
38
36
 
@@ -44,26 +42,16 @@
44
42
 
45
43
  ・変えたところ
46
44
 
47
- keyColour -> keyColours に修正
45
+ - keyColours -> keyColour に修正
48
46
 
49
- ```diff
47
+ - `?`の前に `&& c !== ''` を追加
50
48
 
51
- - const keyColour = (sourceRange.getFontColor(), sourceRange.getBackground());
52
-
53
- + const keyColours = (sourceRange.getFontColor(), sourceRange.getBackground());
54
-
55
- ```
56
-
57
-
58
-
59
- (`?`の前に `&& c !== ''` を追加)
49
+ - if ~ elseは削除
60
-
61
-
62
50
 
63
51
  ```diff
64
52
 
65
53
  - targetRange.setValues(targetValues.map((r,i)=> r.map((c,j) => targetColours[i][j] === keyColours ?designatedValue:c)));
66
54
 
67
- + targetRange.setValues(targetValues.map((r, i) => r.map((c, j) => targetColours[i][j] === keyColours && c !== '' ? designatedValue : c)));
55
+ + targetRange.setValues(targetValues.map((r, i) => r.map((c, j) => targetColours[i][j] === keyColour && c !== '' ? designatedValue : c)));
68
56
 
69
57
  ```

2

2021/12/05 10:46

投稿

退会済みユーザー
test CHANGED
@@ -44,6 +44,18 @@
44
44
 
45
45
  ・変えたところ
46
46
 
47
+ keyColour -> keyColours に修正
48
+
49
+ ```diff
50
+
51
+ - const keyColour = (sourceRange.getFontColor(), sourceRange.getBackground());
52
+
53
+ + const keyColours = (sourceRange.getFontColor(), sourceRange.getBackground());
54
+
55
+ ```
56
+
57
+
58
+
47
59
  (`?`の前に `&& c !== ''` を追加)
48
60
 
49
61
 

1

2021/12/05 10:43

投稿

退会済みユーザー
test CHANGED
@@ -4,9 +4,11 @@
4
4
 
5
5
  const myFunction = () => {
6
6
 
7
- q0A("A1", "B1:D10");
7
+ q0A("A1", "A1:AA1");
8
8
 
9
9
  }
10
+
11
+
10
12
 
11
13
  const q0A = (sourceA1, targetA1, sheetName) => {
12
14