2017年10月14日土曜日

選択しているセルにデータを入力する

現在選択しているセルにデータを入力するコードです。
The code below means "Input data to active area".

コード.gs
function myFunction() {
  var range = SpreadsheetApp.getActiveRange();
  range.setValue("hello");  
}
意訳.gs
この処理は以下を実行する
今選択しているセルを取得して
指定した値を入力する


一行で書くと
SpreadsheetApp.getActiveRange().setValue("hello");