Viktor Iwan
Viktor Iwan

Reputation: 89

Send Cell Data to Custom Function in Google Sheet

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

Upvotes: 0

Views: 42

Answers (1)

Viktor Iwan
Viktor Iwan

Reputation: 89

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

Lesson Learned

Upvotes: 0

Related Questions