Cannot read properties of undefined (reading 'changeType') How to solve this in Apps script?

278 views Asked by At

I'm creating a chatbot by using Uchat and the relevant data is stored in google spread sheets. I have added some triggers as well and the triggers works fine with 0% error rate but the function "onChange" don't run it shows an error mentioning Cannot read properties of undefined (reading 'changeType') the main feature is to record the data in the spread sheets by inserting a new row. Please help me to slove this issue I'm currunetly working as an intern in a company so I'm using company email to get my answers. Thank you Cheers!

This is my code:

function onChange(e){
  changeType = e.changeType;
  sheetName = e.source.getActiveSheet().getSheetName();
  Logger.log(changeType);
  Logger.log(sheetName);
  if (e.changeType !== "INSERT_ROW" || e.source.getActiveSheet().getSheetName() !== "Booking Appointment List") return;

  Utilities.sleep(1000);

  createCalendarEvent();
}```


[This the error message](https://i.stack.imgur.com/n3EzY.png)

I'm expecting any ideas to slove this error. Thank You.
0

There are 0 answers