質問編集履歴
5
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Google Apps ScriptのinsertRowsメソッドで謎のエラー
|
test
CHANGED
File without changes
|
4
mergeメソッドをsetBackgroundRGBメソッドの後ろに配置
test
CHANGED
File without changes
|
test
CHANGED
@@ -85,8 +85,8 @@
|
|
85
85
|
const numberOfMajorEnglish = 4; //単元数
|
86
86
|
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorEnglish); //行を挿入
|
87
87
|
// 科目追加
|
88
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorEnglish).setValue("英語").setBackgroundRGB(56,185,255);
|
88
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorEnglish).setValue("英語").setBackgroundRGB(56,185,255).merge();
|
89
|
-
|
89
|
+
|
90
90
|
//単元追加
|
91
91
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("単語");
|
92
92
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("文法");
|
@@ -100,8 +100,8 @@
|
|
100
100
|
const numberOfMajorJapanese = 2; //単元数
|
101
101
|
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorJapanese); //行を挿入
|
102
102
|
// 科目追加
|
103
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorJapanese).setValue("現代文").setBackgroundRGB(255,66,0);
|
103
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorJapanese).setValue("現代文").setBackgroundRGB(255,66,0).merge();
|
104
|
-
|
104
|
+
|
105
105
|
//単元追加
|
106
106
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("背景知識");
|
107
107
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("読解");
|
@@ -113,8 +113,8 @@
|
|
113
113
|
const numberOfMajorClassic = 4; //単元数
|
114
114
|
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorClassic); //行を挿入
|
115
115
|
// 科目追加
|
116
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorClassic).setValue("古文").setBackgroundRGB(195,66,0);
|
116
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorClassic).setValue("古文").setBackgroundRGB(195,66,0).merge();
|
117
|
-
|
117
|
+
|
118
118
|
//単元追加
|
119
119
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("単語");
|
120
120
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("文法");
|
@@ -128,8 +128,8 @@
|
|
128
128
|
const numberOfMajorChinese = 2; //単元数
|
129
129
|
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorChinese); //行を挿入
|
130
130
|
// 科目追加
|
131
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorChinese).setValue("漢文").setBackgroundRGB(215,65,39);
|
131
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorChinese).setValue("漢文").setBackgroundRGB(215,65,39).merge();
|
132
|
-
|
132
|
+
|
133
133
|
//単元追加
|
134
134
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("文法");
|
135
135
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("長文読解");
|
3
if文内の変数を変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,11 +33,11 @@
|
|
33
33
|
// 1.年間計画表を自動作成
|
34
34
|
|
35
35
|
// 1-1.年間計画表のテンプレートを取得
|
36
|
-
var templateScheduleSheet = DriveApp.getFileById('hog
|
36
|
+
var templateScheduleSheet = DriveApp.getFileById('16VIU26jof49hoiJ6HS27OVsg06tz17kFNzEWnsGgY0w'); //※コピーしてアカウントが変わる場合は変更
|
37
37
|
|
38
38
|
|
39
39
|
// 1-2.生徒氏名を取得
|
40
|
-
const studentNameCellNumber = 2 //アンケート結果シート配置替えで要変更
|
40
|
+
const studentNameCellNumber = 2; //アンケート結果シート配置替えで要変更
|
41
41
|
var studentName = questionSheet.getRange(lastRowNumber,studentNameCellNumber).getValue();
|
42
42
|
|
43
43
|
|
@@ -47,7 +47,7 @@
|
|
47
47
|
|
48
48
|
// 1-4.ファイル名とフォルダIDを取得
|
49
49
|
var newScheduleSheetName = '年間計画表' + studentName + 'さん';
|
50
|
-
var scheduleFolderId = DriveApp.getFolderById('h
|
50
|
+
var scheduleFolderId = DriveApp.getFolderById('1l_2mihnbveca7sDBCO4ium4JRnlT97hy'); //※コピーしてアカウントが変わる場合は変更
|
51
51
|
|
52
52
|
|
53
53
|
// 1-5.年間計画表を新規作成
|
@@ -82,59 +82,60 @@
|
|
82
82
|
|
83
83
|
// 英語
|
84
84
|
if (subjectCell.includes("英語")){
|
85
|
-
|
85
|
+
const numberOfMajorEnglish = 4; //単元数
|
86
|
-
currentScheduleSheet.insertRows(currentLastRow,numberOfMajor); //行を挿入
|
86
|
+
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorEnglish); //行を挿入
|
87
87
|
// 科目追加
|
88
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).setValue("英語").setBackgroundRGB(56,185,255);
|
88
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorEnglish).setValue("英語").setBackgroundRGB(56,185,255);
|
89
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).merge(); //セルを結合
|
89
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorEnglish).merge(); //セルを結合
|
90
90
|
//単元追加
|
91
91
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("単語");
|
92
92
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("文法");
|
93
93
|
currentScheduleSheet.getRange(currentLastRow + 2,majorColumnNumber).setValue("解釈");
|
94
94
|
currentScheduleSheet.getRange(currentLastRow + 3,majorColumnNumber).setValue("長文読解");
|
95
|
-
currentLastRow += numberOfMajor; //最終行を更新
|
95
|
+
currentLastRow += numberOfMajorEnglish; //最終行を更新
|
96
96
|
}
|
97
97
|
|
98
98
|
// 現代文
|
99
99
|
if (subjectCell.includes("現代文")){
|
100
|
-
|
100
|
+
const numberOfMajorJapanese = 2; //単元数
|
101
|
-
currentScheduleSheet.insertRows(currentLastRow,numberOfMajor); //行を挿入
|
101
|
+
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorJapanese); //行を挿入
|
102
102
|
// 科目追加
|
103
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).setValue("現代文").setBackgroundRGB(255,66,0);
|
103
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorJapanese).setValue("現代文").setBackgroundRGB(255,66,0);
|
104
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).merge(); //セルを結合
|
104
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorJapanese).merge(); //セルを結合
|
105
105
|
//単元追加
|
106
106
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("背景知識");
|
107
107
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("読解");
|
108
|
-
currentLastRow += numberOfMajor; //最終行を更新
|
108
|
+
currentLastRow += numberOfMajorJapanese; //最終行を更新
|
109
109
|
}
|
110
110
|
|
111
111
|
// 古文
|
112
112
|
if (subjectCell.includes("古文")){
|
113
|
-
|
113
|
+
const numberOfMajorClassic = 4; //単元数
|
114
|
-
currentScheduleSheet.insertRows(currentLastRow,numberOfMajor); //行を挿入
|
114
|
+
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorClassic); //行を挿入
|
115
115
|
// 科目追加
|
116
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).setValue("古文").setBackgroundRGB(195,66,0);
|
116
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorClassic).setValue("古文").setBackgroundRGB(195,66,0);
|
117
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).merge(); //セルを結合
|
117
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorClassic).merge(); //セルを結合
|
118
118
|
//単元追加
|
119
119
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("単語");
|
120
120
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("文法");
|
121
121
|
currentScheduleSheet.getRange(currentLastRow + 2,majorColumnNumber).setValue("解釈");
|
122
122
|
currentScheduleSheet.getRange(currentLastRow + 3,majorColumnNumber).setValue("長文読解");
|
123
|
-
currentLastRow += numberOfMajor; //最終行を更新
|
123
|
+
currentLastRow += numberOfMajorClassic; //最終行を更新
|
124
124
|
}
|
125
125
|
|
126
126
|
// 漢文
|
127
127
|
if (subjectCell.includes("漢文")){
|
128
|
-
|
128
|
+
const numberOfMajorChinese = 2; //単元数
|
129
|
-
currentScheduleSheet.insertRows(currentLastRow,numberOfMajor); //行を挿入
|
129
|
+
currentScheduleSheet.insertRows(currentLastRow,numberOfMajorChinese); //行を挿入
|
130
130
|
// 科目追加
|
131
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).setValue("漢文").setBackgroundRGB(215,65,39);
|
131
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorChinese).setValue("漢文").setBackgroundRGB(215,65,39);
|
132
|
-
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajor).merge(); //セルを結合
|
132
|
+
currentScheduleSheet.getRange(currentLastRow,subjectColumnNumber,numberOfMajorChinese).merge(); //セルを結合
|
133
133
|
//単元追加
|
134
134
|
currentScheduleSheet.getRange(currentLastRow,majorColumnNumber).setValue("文法");
|
135
135
|
currentScheduleSheet.getRange(currentLastRow + 1,majorColumnNumber).setValue("長文読解");
|
136
|
-
currentLastRow += numberOfMajor; //最終行を更新
|
136
|
+
currentLastRow += numberOfMajorChinese; //最終行を更新
|
137
137
|
}
|
138
|
+
|
138
139
|
}
|
139
140
|
```
|
140
141
|
|
2
タイトルの変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Google Apps ScriptのinsertRowsメソッドでエラー
|
1
|
+
【解決者求む】Google Apps ScriptのinsertRowsメソッドで謎のエラー
|
test
CHANGED
File without changes
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,9 +76,9 @@
|
|
76
76
|
|
77
77
|
// 条件分岐で科目表示
|
78
78
|
|
79
|
-
var currentLastRow = 14 // 科目セルの1つ下の行
|
79
|
+
var currentLastRow = 14; // 科目セルの1つ下の行
|
80
80
|
const subjectColumnNumber = 2; //科目列
|
81
|
-
const majorColumnNumber = 3 //単元列
|
81
|
+
const majorColumnNumber = 3; //単元列
|
82
82
|
|
83
83
|
// 英語
|
84
84
|
if (subjectCell.includes("英語")){
|
@@ -144,6 +144,7 @@
|
|
144
144
|
- [x] 該当エラー箇所をコメントアウトして正常に動くか確認(エラーは起きなかった)
|
145
145
|
- [x] insertRowsの引数の型に誤りがないか確認
|
146
146
|
- [x] Google検索やchatGPTを用いて原因を探るも特定できず
|
147
|
+
- [x] 変数の宣言で";"の書き忘れなどがないか確認
|
147
148
|
|
148
149
|
### 補足情報(FW/ツールのバージョンなど)
|
149
150
|
|