I need any edits/changes to a specific cell, in a specific sheet (tab) to generate an onEdit trigger.
I have searched, and tried, dozens of potential solutions, but can’t seem to make any of them work.
My specific 'edit' cell is "H8" and it is located on a sheet (tab) called: “Land”
And just for this example, I want the trigger to delete the contents of Cell “A1” on sheet: “test”
Attempt #1: Based on this link: https://stackoverflow.com/a/48964929/11317736
function onEdit(e) {
if (e.range.getA1Notation() === 'Land!H8') {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('test').getRange('A1').clear();
}
}
ERROR CODE: TypeError: Cannot read property "source" from undefined. (line 2, file "Code")Dismiss
Attempt #2: Based on many different posts
function onEdit(e) {
var range = e.range;
var rangeEdit = e.range.getA1Notation();
if(rangeEdit == "Land!H8"){
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('test').getRange('A1').clear();
}
}
ERROR CODE: TypeError: Cannot read property "range" from undefined.
Any help would be greatly appreciated