Hello!
I am having issues with a trigger not running when a cell is filled in with data from another sheet.
On the sheet that I am trying to run the trigger I have the following function bringing unique information in:
=(UNIQUE('Responses'!D1:D))
This is working great. When a unique entry is entered the data shows up.
Then I have this script that I want to trigger when the above function gets a new entry.
function onEdit(e)
{
var sheet = e.source.getActiveSheet();
if (sheet.getName() == "Calculations") //"order data" is the name of the sheet where you want to run this script.
{
var actRng = sheet.getActiveRange();
var editColumn = actRng.getColumn();
var rowIndex = actRng.getRowIndex();
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues();
var dateCol = headers[0].indexOf("Start Date") + 1;
var orderCol = headers[0].indexOf("Name") + 1;
if (dateCol > 0 && rowIndex > 1 && editColumn == orderCol)
{
sheet.getRange(rowIndex, dateCol).setValue(Utilities.formatDate(new Date(), "UTC+8", "MM-dd-yyyy"));
}
}
}
The script runs but only when I delete the data and it gets regenerated by the Unique function.
Any help will be appreciated.
Thank you!
Luis