質問編集履歴

3

#を1つにしたら\マークが出るの?

2018/03/27 00:41

投稿

koromo_t
koromo_t

スコア60

test CHANGED
File without changes
test CHANGED
File without changes

2

あっ、#の数を減らしたら、文字の大きさが大きくなるんですね!! こりゃいいや。

2018/03/27 00:41

投稿

koromo_t
koromo_t

スコア60

test CHANGED
File without changes
test CHANGED
@@ -193,3 +193,139 @@
193
193
  関連の質問を投稿しました。もしよかったら見てください。
194
194
 
195
195
  [https://teratail.com/questions/116569](https://teratail.com/questions/116569)
196
+
197
+
198
+
199
+
200
+
201
+ #**~解決後のまとめ~**
202
+
203
+ stshishoさんの回答を参考に解決しましたので、まとめておきます。
204
+
205
+
206
+
207
+ ---
208
+
209
+ 完成形です。
210
+
211
+ あ、でもなにか思うところがあれば、コメントしていただけるとうれしいです。
212
+
213
+
214
+
215
+ ```javaScript
216
+
217
+ function sendNotification() {
218
+
219
+ //変数spreadsheetに指定のスプレッドシートオブジェクトを取得します
220
+
221
+ var url = "***";
222
+
223
+ var sheet = SpreadsheetApp.openByUrl(url);
224
+
225
+ var ss = SpreadsheetApp.getActiveSpreadsheet();
226
+
227
+ var val = sheet.getRange('B'+ sheet.getLastRow()).getValue();
228
+
229
+ var val2 = sheet.getRange('D'+ sheet.getLastRow()).getValue();
230
+
231
+ var val3 = sheet.getRange('A'+ sheet.getLastRow()).getValue();
232
+
233
+ // もし列Dの値に異動があれば
234
+
235
+ if(val2!=''){ // = if you edit data in col D
236
+
237
+ var dAddress = "***";
238
+
239
+ var subject = "***";
240
+
241
+ var content = "名前:"+val+"\n";
242
+
243
+ content += Utilities.formatDate(val3,'JST','yyyy年M月d日 H時m分')+"\n";
244
+
245
+ content += "**********************\n"+val2;
246
+
247
+ MailApp.sendEmail(dAddress,subject,content);
248
+
249
+ }
250
+
251
+
252
+
253
+ var target_col = 1;
254
+
255
+ var asc = false;
256
+
257
+ var start_row = 2;
258
+
259
+ var start_col = 1;
260
+
261
+
262
+
263
+ var sh = SpreadsheetApp.getActiveSheet();
264
+
265
+ var last_col = sh.getLastColumn();
266
+
267
+ var last_row = sh.getLastRow();
268
+
269
+ var num_rows = last_row - (start_row - 1);
270
+
271
+ var num_cols = last_col - (start_col - 1);
272
+
273
+ var range = sh.getRange(start_row, start_col, num_rows, num_cols);
274
+
275
+ range.sort([{
276
+
277
+ column: target_col,
278
+
279
+ ascending: asc
280
+
281
+ }]);
282
+
283
+ }
284
+
285
+ ```
286
+
287
+
288
+
289
+ ### 参考記事(2018/03/27 追記)
290
+
291
+ ・[https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10173170780](https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10173170780)
292
+
293
+ こちらのベストアンサーの方の書かれたスクリプトをベースにしました。
294
+
295
+ ・[https://tonari-it.com/gas-moment-js-format/](https://tonari-it.com/gas-moment-js-format/)
296
+
297
+ 日付と時刻の書式フォーマットに関するスクリプトをお借りしました。
298
+
299
+ ・[http://www.pre-practice.net/2016/06/blog-post_22.html](http://www.pre-practice.net/2016/06/blog-post_22.html)
300
+
301
+ データのソートに関するスクリプトをお借りしました。
302
+
303
+ あと、「getLastRow()」で一番下の行を取得できることを知りました。
304
+
305
+ ・[http://emplos.jp/news/3336.html](http://emplos.jp/news/3336.html)
306
+
307
+ 「\n」と書くと文章が改行されることを知りました。
308
+
309
+ 変数内で「+=」と書くと、文章を追加できることを知りました。これを使うと見やすくなる。
310
+
311
+ ・[https://teratail.com/questions/116487](https://teratail.com/questions/116487)
312
+
313
+ 当記事です。特定のセルの値を走査する方法を教えていただきました。
314
+
315
+
316
+
317
+ 本題から若干それますが、
318
+
319
+ ・[https://code.i-harness.com/ja/q/ea05cb](https://code.i-harness.com/ja/q/ea05cb)
320
+
321
+ ここから「function sendNotification()」という関数名をいただいたみたいです。
322
+
323
+ ・[https://qiita.com/nurburg/items/744ec53477f4ae328555](https://qiita.com/nurburg/items/744ec53477f4ae328555)
324
+
325
+ URLを指定して別のスプレッドシートを開く方法はこちらの記事からいただいたみたいですが、
326
+
327
+ そんなことしなくても、「getActiveSheet()」でいいと、いまとなってはわかるのです…。
328
+
329
+
330
+
331
+ 以上、おそらくこのあたりの記事を参考にしたのだと思われます。

1

追記しました。

2018/03/27 00:34

投稿

koromo_t
koromo_t

スコア60

test CHANGED
File without changes
test CHANGED
@@ -185,3 +185,11 @@
185
185
  当方、先にも述べましたが、ずぶの素人なので、的外れなことを書いていたらすみません。
186
186
 
187
187
  多少、大目に見ていただけると、ありがたいです。
188
+
189
+
190
+
191
+ ### 追記
192
+
193
+ 関連の質問を投稿しました。もしよかったら見てください。
194
+
195
+ [https://teratail.com/questions/116569](https://teratail.com/questions/116569)