回答編集履歴
1
変数の利用部分を修正しました。
answer
CHANGED
@@ -15,7 +15,8 @@
|
|
15
15
|
// 読み取り範囲(表の始まり行と終わり列)
|
16
16
|
const topRow = 1;
|
17
17
|
const lastCol = 8;
|
18
|
+
const statusCellCol = 1;
|
18
|
-
|
19
|
+
const eventIDCol = 9; // ★追加
|
19
20
|
|
20
21
|
// 予定の一覧バッファ内の列(0始まり)
|
21
22
|
const statusNum = 0;
|
@@ -26,14 +27,13 @@
|
|
26
27
|
const locationNum = 5;
|
27
28
|
const descriptionNum = 6;
|
28
29
|
const colorNum = 7;
|
29
|
-
const eventIDCol = 8; // ★追加
|
30
30
|
|
31
31
|
// シートを取得
|
32
32
|
const activeSpreadSheet = SpreadsheetApp.getActiveSpreadsheet(); // 現在のSpreadSheetを取得
|
33
33
|
const sheet = activeSpreadSheet.getSheetByName('log'); // シート(SpreadSheetの下のタブ名を指定)
|
34
34
|
|
35
35
|
// 予定の最終行を取得
|
36
|
-
const
|
36
|
+
const lastRow = sheet.getLastRow(); // let → const
|
37
37
|
|
38
38
|
//予定の一覧をバッファに取得
|
39
39
|
const contents = sheet.getRange(topRow, 1, sheet.getLastRow(), lastCol).getValues();
|
@@ -96,8 +96,8 @@
|
|
96
96
|
}
|
97
97
|
|
98
98
|
console.log(calevent.getId()); //★修正
|
99
|
-
sheet.getRange(topRow + i,
|
99
|
+
sheet.getRange(topRow + i, statusCellCol).setValue('済'); // ★追加
|
100
|
-
sheet.getRange(topRow + i, eventIDCol
|
100
|
+
sheet.getRange(topRow + i, eventIDCol).setValue(calevent.getId()); // ★修正
|
101
101
|
// エラーの場合ログ出力する
|
102
102
|
} catch (e) {
|
103
103
|
Logger.log(e);
|