Gửi mọi người code mình mới sưu tầm được trên mạng về timestamp trên google sheets rất hay có thể tạo nhiều realtime.
Một số nguồn tham khảo :
hocggsheet.com
www.internetgeeks.org
Mã:
function onEdit(event)
{
var timezone = "GMT+7";
var timestamp_format = "MM-dd-yyyy hh:mm"; // Timestamp Format.
var updateColName = "b";
var timeStampColName = "d";
var updateColName1 = "a";
var timeStampColName1 = "c";
var sheet = event.source.getSheetByName('Test'); //Name of the sheet where you want to run this script.
var actRng = event.source.getActiveRange();
var editColumn = actRng.getColumn();
var index = actRng.getRowIndex();
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues();
var dateCol = headers[0].indexOf(timeStampColName);
var updateCol = headers[0].indexOf(updateColName); updateCol = updateCol+1;
var dateCol1 = headers[0].indexOf(timeStampColName1);
var updateCol1 = headers[0].indexOf(updateColName1); updateCol1 = updateCol1+1;
if (dateCol > -1 && index > 1 && editColumn == updateCol) { // only timestamp if 'Last Updated' header exists, but not in the header row itself!
var cell = sheet.getRange(index, dateCol + 1);
var date = Utilities.formatDate(new Date(), timezone, timestamp_format);
cell.setValue(date);
}
if (dateCol1 > -1 && index > 1 && editColumn == updateCol1) { // only timestamp if 'Last Updated' header exists, but not in the header row itself!
var cell = sheet.getRange(index, dateCol1 + 1);
var date1 = Utilities.formatDate(new Date(), timezone, timestamp_format);
cell.setValue(date1);
}
}

Ghi công thức Google Sheet vào ô bằng App Script - Học App Script Sheet
Trong bài này hocggshet.com sẽ chia sẻ về cách ghi những công thức excel hay google sheet vào một ô bằng app script thông qua hàm setFormula


How to Auto Insert Timestamp in Google Sheet - Internet Geeks
Google sheet is one of my favorite Google App and I use it . Today I came across a video on “How to add a Timestamp in Google Docs“. It shows how to install a script which will add a timestamp automatically to last column. While this is a very good script, but I wanted to [...]
