Sweekiong Er
Sweekiong Er

Reputation: 1

TypeError: Cannot read property 'getValue' of undefined at onEdit

function onEdit(e){
e.range.getValue()

}

I am just trying to run a simple onEdit code in Google Sheets, but the trigger execution log keep showing:

TypeError: Cannot read property 'getValue' of undefined at onEdit(Code:4:17)

log

Upvotes: 0

Views: 779

Answers (1)

Cooper
Cooper

Reputation: 64062

Try running it this way:

Run test_onxxxEdit();

function test_onxxxEdit() {
  const ss=SpreadsheetApp.getActive();
  const sh=ss.getActiveSheet();
  const rg=ss.getRange(?);
  const v=rg.getValue();
  onxxxEdit({source:ss,range:rg,value:v});
}

function onxxxEdit(e){
  e.range.getValue()

}

Upvotes: 1

Related Questions