質問編集履歴
1
コードを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,4 +44,144 @@
|
|
44
44
|
|
45
45
|
|
46
46
|
|
47
|
+
```ここに言語を入力
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
function myFunction() {
|
54
|
+
|
55
|
+
//ソート・星式コピー
|
56
|
+
|
57
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
58
|
+
|
59
|
+
spreadsheet.getRange('H4').activate();
|
60
|
+
|
61
|
+
var criteria = SpreadsheetApp.newFilterCriteria()
|
62
|
+
|
63
|
+
.setHiddenValues(['××', '××', '××', '××', '××', '××', '××'])
|
64
|
+
|
65
|
+
.build();
|
66
|
+
|
67
|
+
spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(8, criteria);
|
68
|
+
|
69
|
+
spreadsheet.getCurrentCell().offset(40, 2).activate();
|
70
|
+
|
71
|
+
var destinationRange = spreadsheet.getActiveRange().offset(0, 0, 530);
|
72
|
+
|
73
|
+
spreadsheet.getActiveRange().autoFill(destinationRange, SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
|
74
|
+
|
75
|
+
spreadsheet.getCurrentCell().offset(0, 0, 530, 1).activate();
|
76
|
+
|
77
|
+
spreadsheet.getRange('H4').activate();
|
78
|
+
|
79
|
+
criteria = SpreadsheetApp.newFilterCriteria()
|
80
|
+
|
47
|
-
|
81
|
+
.setHiddenValues([])
|
82
|
+
|
83
|
+
.build();
|
84
|
+
|
85
|
+
spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(8, criteria);
|
86
|
+
|
87
|
+
spreadsheet.getRange('G4').activate();
|
88
|
+
|
89
|
+
criteria = SpreadsheetApp.newFilterCriteria()
|
90
|
+
|
91
|
+
.setHiddenValues(['××', '××'])
|
92
|
+
|
93
|
+
.build();
|
94
|
+
|
95
|
+
spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(7, criteria);
|
96
|
+
|
97
|
+
spreadsheet.getCurrentCell().offset(1, 3).activate();
|
98
|
+
|
99
|
+
destinationRange = spreadsheet.getActiveRange().offset(0, 0, 530);
|
100
|
+
|
101
|
+
spreadsheet.getActiveRange().autoFill(destinationRange, SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
|
102
|
+
|
103
|
+
spreadsheet.getCurrentCell().offset(0, 0, 530, 1).activate();
|
104
|
+
|
105
|
+
spreadsheet.getRange('G4').activate();
|
106
|
+
|
107
|
+
criteria = SpreadsheetApp.newFilterCriteria()
|
108
|
+
|
109
|
+
.setHiddenValues([])
|
110
|
+
|
111
|
+
.build();
|
112
|
+
|
113
|
+
spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(7, criteria);
|
114
|
+
|
115
|
+
//列挿入
|
116
|
+
|
117
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
118
|
+
|
119
|
+
spreadsheet.getRange('I:I').activate();
|
120
|
+
|
121
|
+
spreadsheet.getActiveSheet().insertColumnsAfter(spreadsheet.getActiveRange().getLastColumn(), 2);
|
122
|
+
|
123
|
+
spreadsheet.getActiveRange().offset(0, spreadsheet.getActiveRange().getNumColumns(), spreadsheet.getActiveRange().getNumRows(), 2).activate();
|
124
|
+
|
125
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
126
|
+
|
127
|
+
spreadsheet.getRange('L:L').activate();
|
128
|
+
|
129
|
+
spreadsheet.getActiveSheet().insertColumnsAfter(spreadsheet.getActiveRange().getLastColumn(), 2);
|
130
|
+
|
131
|
+
spreadsheet.getActiveRange().offset(0, spreadsheet.getActiveRange().getNumColumns(), spreadsheet.getActiveRange().getNumRows(), 2).activate();
|
132
|
+
|
133
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
134
|
+
|
135
|
+
spreadsheet.getRange('O:O').activate();
|
136
|
+
|
137
|
+
spreadsheet.getActiveSheet().insertColumnsAfter(spreadsheet.getActiveRange().getLastColumn(), 2);
|
138
|
+
|
139
|
+
spreadsheet.getActiveRange().offset(0, spreadsheet.getActiveRange().getNumColumns(), spreadsheet.getActiveRange().getNumRows(), 2).activate();
|
140
|
+
|
141
|
+
//数式入力・オートフィル・値コピー
|
142
|
+
|
143
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
144
|
+
|
145
|
+
spreadsheet.getRange('J5').activate()
|
146
|
+
|
147
|
+
.setFormula('=MAXIFS(I:I,D:D,D5)');
|
148
|
+
|
149
|
+
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('J5:J538'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
|
150
|
+
|
151
|
+
spreadsheet.getRange('K5').activate();
|
152
|
+
|
153
|
+
spreadsheet.getRange('J5').copyTo(spreadsheet.getActiveRange(), {contentsOnly:true});
|
154
|
+
|
155
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
156
|
+
|
157
|
+
spreadsheet.getRange('M5').activate()
|
158
|
+
|
159
|
+
.setFormula('=SUMIFS(L:L,D:D,D5)');
|
160
|
+
|
161
|
+
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('M5:M538'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
|
162
|
+
|
163
|
+
spreadsheet.getRange('N5').activate();
|
164
|
+
|
165
|
+
spreadsheet.getRange('M5').copyTo(spreadsheet.getActiveRange(), {contentsOnly:true});
|
166
|
+
|
167
|
+
var spreadsheet = SpreadsheetApp.getActive();
|
168
|
+
|
169
|
+
spreadsheet.getRange('P5').activate()
|
170
|
+
|
171
|
+
.setFormula('=MAXIFS(O:O,D:D,D5)');
|
172
|
+
|
173
|
+
spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('P5:P538'), SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
|
174
|
+
|
175
|
+
var sheet = SpreadsheetApp.getActiveSheet()
|
176
|
+
|
177
|
+
var range = sheet.getRange('M:M');
|
178
|
+
|
179
|
+
var target = sheet.getRange('N:N');
|
180
|
+
|
181
|
+
range.copyTo(target, {contentsOnly:true});
|
182
|
+
|
183
|
+
};
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```
|