I have a Google Sheets App script which modifies a cell in the new row when a new row is added. It works fine, but the function also runs unexpectedly when a row is moved (by dragging it up or down the sheet). It looks like the 'INSERT_ROW' is being referenced even if a row is just moved. I would like the function to only execute if a new row is explicitly added (insert row above/insert row below). Is this possible? Here's what I have so far.
function myAddRow(e) {
var sh = SpreadsheetApp.getActiveSheet();
if(e.changeType === 'INSERT_ROW') {
var row = sh.getActiveRange().getRow();
sh.getRange(row, 18).setValue('=HYPERLINK("http://maps.google.com/maps?q="&S' + row + ',"Map")');
}
}
Thanks!