LoginSignup
0
0

More than 1 year has passed since last update.

GAS 基礎編③メモ

Posted at

GASの勉強中です。
自分用メモ

確認用メッセージボックスの表示

 if (Browser.msgBox('シートの初期化', '実行していいですか?', Browser.Buttons.OK_CANCEL) === 'cancel') {
    return;
  }
# function全体
function initSheet() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var names = ['taguchi', 'fkoji', 'dotinstall'];
  var i;
  var scores = [];

  if (Browser.msgBox('シートの初期化', '実行していいですか?', Browser.Buttons.OK_CANCEL) === 'cancel') {
    return;
  }

  sheet.clear();

  for (i = 1; i <= 10; i++) {
    scores.push([
      names[Math.floor(Math.random() * names.length )],
      Math.floor(Math.random() * 101 )
    ]);
  }

  sheet.getRange(1, 1, 10, 2).setValues(scores);
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0