Googleスプレッドシート用のスクリプトをいくつかコーディングしています。関数の 1 つは、ユーザー入力を取得する必要があります。その後、他のいくつかの関数で入力を利用する必要があります。その 1 つのサンプルを以下に示します。質問は、入力を使用する必要があるたびに関数「Setup()」を呼び出す必要があるかどうかです。それは、入力を複数回要求することを意味しますが、それはばかげていると私は知っています。
どうすればこれを回避できますか?
ありがとう!
var setupdone = false;
function Setup(){
  if(!setupdone){
    numofTeams = Browser.inputBox('Confirm the number of Teams');
    var ui = Browser.msgBox('Ensure that the teams are arranged according to lane allocations below', Browser.Buttons.OK_CANCEL);
    setupdone = true;
  }
  var semisraw = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Secondary Group 1');
  var range = semisraw.getDataRange();
  values = range.getValues();
};
function numofTeamsprint(){
  Setup();
  Browser.msgBox('Setup is Complete!');
};