0
votes

i made a simple substring checker for a cell... in sheet i add formula '=searchCode(B2)'

now on Google App Script, i add this code

function searchCode(theData) {
  if(theData.indexOf("BP1")>0){
   return "found";
       }else{
   return "not Found";
  }

}

The problem App Script return error "Cannot read property 'indexOf' of undefined. I'm thinking google sheet send B2 Cell as Object and not just regular cell

Any idea on how to solve this issue ?

Thanks

1
It would only mean that you're calling there function without theData. Nothing else. - TheMaster
Thank you, it return error on the App Editor, but it actually work in Google Sheet itself - Viktor Iwan

1 Answers

0
votes

Actually i found it works via Google Sheet, it return error when i test it in the Apps Editor.

Lesson Learned