回答編集履歴
2
a
test
CHANGED
@@ -1,5 +1,33 @@
|
|
1
|
-
|
1
|
+
```javascript
|
2
2
|
|
3
|
+
const q243601 = () => {
|
3
4
|
|
5
|
+
const src_id = "";
|
4
6
|
|
7
|
+
const dst_id = "";
|
8
|
+
|
9
|
+
const src_sheetName = "";
|
10
|
+
|
11
|
+
const dst_sheetName = "";
|
12
|
+
|
13
|
+
const condition = {column: "U", value: "入荷済"};
|
14
|
+
|
5
|
-
|
15
|
+
const isInStock = validatorBuilder(condition);
|
16
|
+
|
17
|
+
const dat = SpreadsheetApp.openById(src_id).getSheetByName(src_sheetName).getDataRange().getValues().filter(isInStock);
|
18
|
+
|
19
|
+
if (dat.length === 0) return;
|
20
|
+
|
21
|
+
const dst = SpreadsheetApp.openById(dst_id).getSheetByName(dst_sheetName);
|
22
|
+
|
23
|
+
const r = dst.getLastRow() + 1;
|
24
|
+
|
25
|
+
dst.getRange(r, 1, dat.length, dat[0].length).setValues(dat);
|
26
|
+
|
27
|
+
};
|
28
|
+
|
29
|
+
const validatorBuilder = (cond) => (e) => e[getColNumber(cond.column)] === cond.value;
|
30
|
+
|
31
|
+
const getColNumber = (alpha) => "ABCDEFGHIJKLMNOPQLSTUVWXYZ".indexOf(alpha.toUpperCase());
|
32
|
+
|
33
|
+
```
|
1
あ
test
CHANGED
@@ -1 +1,5 @@
|
|
1
1
|
checkColValue はobject[][]なので、checkColValue == "入荷済"は必ずfalseになり、コピー処理は実行されません。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
ここを、直してもcopyValueが行を判定してないので、全部コピーされてしまいます。
|