LoginSignup
25
30

More than 5 years have passed since last update.

[超簡単] spreadsheetを更新したら自動で更新日付を入れるGAS

Last updated at Posted at 2015-09-11

今回のアウトプット

image

簡単なGASでサクッと実装します。

コード

GoogleAppsScript
function insertLastUpdated() {
  var ss = SpreadsheetApp.getActiveSheet(); 
  var currentRow = ss.getActiveCell().getRow(); 
  var currentCell = ss.getActiveCell().getValue(); 
  var updateRange = ss.getRange('F' + currentRow) //更新日をいれる列をstringで指定。この場合はF列
  Logger.log(updateRange);
  //更新日の記入
  if(currentRow>1){ 
    if(currentCell) { 
      updateRange.setValue(new Date());
    }
  }
}

トリガー

  • トリガーを値の変更にしておくと、シート更新時に上記の機能が走ります。

image

コメント

  • タスク管理系はspreadsheetでいろいろ自動化できそうですね。
  • smarbyでは法人営業管理シートなどでこの機能が活躍中。
25
30
1

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
25
30