0

ヘルプ!Google シートでは、行内のセルが更新または改訂された最後の日付と時刻を 1 つの列に入力したいだけです。例: a1 - 最終改訂日、b1-z1 (a1 の後の任意の数のセル) - その行のセルが更新または改訂されるたびに、a1 の日付が更新されます。

同じスクリプトを複数のシートに適用したい。

最初はうまく機能しているように見えたこのスクリプトを見つけました:

function onEdit(event){
  var ss = SpreadsheetApp.getActiveSpreadsheet();


  //Script Last Update Timing

  var actSht = event.source.getActiveSheet();
  var actRng = event.source.getActiveRange();

  var activeCell = actSht.getActiveCell();
  var row = activeCell.getRow();
  var column = activeCell.getColumn();

  if(row < 2)   return; //If header row then return
    var colNums  = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,  20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34]; //Coulmns, whose edit is considered
  if(colNums.indexOf(column) == -1) return; //If column other than considered then return


  var index = actRng.getRowIndex();
  var dateCol = actSht.getLastColumn();
  var lastCell = actSht.getRange(index,dateCol);
  var date = Utilities.formatDate(new Date(), "GMT+5:30", "dd/MM/yyyy HH:mm:ss");
  // Note: Insert the Date when someone update the row in the last coulmn
  lastCell.setValue(date);
}

テストしていたときは問題なく動作しましたが、その日以降は動作しないか、時々動作するか、自分でリビジョンを作成すると動作しますが、ファイルを共有している人とは動作しません。

スクリプトについては何も知りませんが、1 週間検索した後、誰かが私を正しい方向に導いてくれることを願って、投稿することにしました。

どんな助けでも大歓迎です!前もって感謝します!

4

1 に答える 1