Answer the question
In order to leave comments, you need to log in
How to write a script in a Google spreadsheet for auto-completion and date reserve in several columns?
It turned out to register the script for only one column. It looks like this:
function onEdit(e) {
var sheet = e.source.getActiveSheet();
var idCol = e.range.getColumn();
var idRow = e.range.getRow();
if ( idCol == 2 && sheet.getName() =='Лист1' ) {
var Value = e.range.offset(1, +5).getValues();
if ( Value == "" ) {
var vartoday = getDate();
sheet.getRange(idRow, 6).setValue( vartoday );
}
}
}
// Returns YYYYMMDD-formatted date.
function getDate() {
var today = new Date();
today.setDate(today.getDate());
//return Utilities.formatDate(today, 'PST', 'yyyy.MM.dd');
return Utilities.formatDate(today, 'GMT+03:00', 'yyyy.MM.dd');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question