teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

動画をアップしました

2020/11/13 04:53

投稿

nobinomio
nobinomio

スコア45

title CHANGED
File without changes
body CHANGED
@@ -14,6 +14,8 @@
14
14
  こちらのページを参照にしています
15
15
 
16
16
  https://tonari-it.com/gas-if/
17
+ 動画でやりたいことを説明しています
18
+ https://youtu.be/s39c1KRHtQ0
17
19
 
18
20
  ```Google Apps Script
19
21
 

2

2020/11/13 04:53

投稿

nobinomio
nobinomio

スコア45

title CHANGED
File without changes
body CHANGED
@@ -1,18 +1,31 @@
1
1
  googleスプレッドシートで下記のGAScodeを組んでいます
2
+ スプレッドシートのA1~A10のセルに
3
+ A1セル
4
+ りんご/
5
+ みかん/
6
+ いちご/
7
+ バナナ/
2
- スプレッドシートA1~A99まで数字が入力されています。
8
+ 上記ように1つのセルに改行されて文字が入力されています。
3
- B1からA列の内容をfor文でだしたいのですが
9
+ B1に関数SPLIT = SPLIT(A1,"/")を入れています。この内容をB2行目からB10行目までfor文でだしたいのですが
4
10
  consoleの書き込み方法まではわかったのですが
5
- 直接Bへの書き込み方がわかりません。
11
+ 直接Bへの書き込み方がわかりません。
6
12
  だれか教えていただければと思います
7
13
 
8
14
  こちらのページを参照にしています
15
+
9
16
  https://tonari-it.com/gas-if/
17
+
10
18
  ```Google Apps Script
19
+
11
20
  function myFunction() {
12
- const sheet = SpreadsheetApp.getActiveSheet();
21
+ const sheet = SpreadsheetApp.getActiveSheet();
13
22
  const lastRow = sheet.getLastRow();
23
+
14
24
  for(let i = 2; i <= lastRow; i++) {
25
+ if(!sheet.getRange(i, 2).getValue()){
15
- console.log(sheet.getRange(i, 1).getValue());
26
+ console.log(sheet.getRange(i, 1).getValue());
27
+ }
16
28
  }
17
29
  }
30
+
18
31
  ```

1

2020/11/13 00:04

投稿

nobinomio
nobinomio

スコア45

title CHANGED
File without changes
body CHANGED
File without changes