if I use the following function within Google Sheets it doesn\'t return the value \"not found\". The logs tell me: \"Execution cancelled\".
This happens at the line:
The return value of string.match
,
An Array whose contents depend on the presence or absence of the global (g) flag, or null if no matches are found.
and
null !== undefined
So, when it's null, the else
statement executes and returns null to sheet. The "execution cancelled" is irrelevant and probably from old logsissue
Use null to compare return value.
if (found === null) {