LoginSignup
32
31

More than 5 years have passed since last update.

SpreadSheet にてシートの最終更新日時を自動挿入する GoogleAppScript

Last updated at Posted at 2015-12-29

下記のようにシート毎の最終更新日時がA1セルに自動的に挿入されるようになります。

image

やり方

  1. 挿入したいスプレッドシートのメニューから AppScriptの編集画面を開く
    image

     

  2. 下記AppScriptを設定する

    Code.gs
    function insertLastUpdated() {
      SpreadsheetApp.getActiveSheet()
        .getRange('A1') //挿入したいセル
        .setValue(
          '最終更新: ' + Utilities.formatDate(new Date(), 'JST', 'yyyy年MM月dd日HH時mm分ss秒') + //日時フォーマット
          ' by ' + Session.getActiveUser().getEmail() //更新したユーザーアカウント
        )
        .setFontColor('red'); //文字色
    }
    
  3. スプレッドシートのトリガーを設定する
    image
     
    image

32
31
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
32
31