0

trigger installedI am getting this error when running :TypeError: Cannot read property 'range' of undefined at onformsubmit(Code:10:17) I have installed the onformsubmit trigger but it is not working. What is not working here?

function onformsubmit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();

  var range = e.range;
  var row = range.getRow();
  var sheet = range.getSheet();

  sheet.getRange(row, 17).setFormula("=if($O"+row+"=\"UZS\",index(googlefinance(\"currency:UZSUSD\",\"price\",$B"+row+"),2,2)*$P"+row+",if($O"+row+"=\"EUR\",index(googlefinance(\"currency:EURUSD\",\"price\",$B"+row+"),2,2)*$P"+row+",$P"+row+"))");
}
1

It's very likely that you are running the onformsubmit function from the script editor which don't send an event object (e).

In order to run osformsubmit from the Google Apps Editor for debugging purposes, you have to create a an auxiliary function to create the event object and assign the required properties. For a broader explanation see the answer from Mogsdad to How can I test a trigger function in GAS?

Related

2
  • even though I have created the event object the very error is occurring again – Aroon Advisory Group Mar 25 '20 at 15:29
  • @AroonAdvisoryGroup Please create a new question including enough details to understand how do you created the event object and how you are using it. – Rubén Mar 25 '20 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.