I have this code in google sheets:
function copy(row) {
var value = sheet.getRange(row, 1).getValue();
sheet.getRange(row, 3).setValue(value);
}
Then i change function onEdit
function onEdit(e){
var range = e.range;
copy(range.getRow());
}
Now this script copy some row, who we edit.
But i needed copy this row to other sheet. And if i make like this:
function copy(row) {
var value = sheet.getRange(row, 1).getValue();
var sheetTo = SpreadsheetApp.openById(ID).getSheetByName(NAME);
sheetTo.getRange(row, 3).setValue(value);
}
It is not working. (If call function from editor it working well)
Please, help