From the question:
Formula
=query(nor9609s!A1:Z500,querybyname(A1:Z1,"SELECT `Items_shopid` WHERE `Items_id`>0"))
Error message:
TypeError: item.toLowerCase is not a function (line 26)
Apparently the code line from the QueryByName custom function that in your case is throwing the referrerd error message is the following:
// Lowercase all heading names so that case errors are accepted
const headings = columnHeadings[0].map(item => item.toLowerCase());
The error occurs because there some values in A1:Z1
that aren't a string. One the way to fix this is to convert these values to text values. I.E. the following formula use TO_TEXT
and ArrayFormula
:
=ArrayFormula(query(nor9609s!A1:Z500,querybyname(TO_TEXT(A1:Z1),"SELECT `Items_shopid` WHERE `Items_id`>0")))
NOTES:
The formula shown in the screenshot is not using backticks, it's using apostrophes. Please read carefully the instructions from the referred answer.
You might found helpful the programming section of the following resources:
QueryByName
is not a Google Sheets built-in function. Does it comes from a bounded script or from an add-on?// Use a regular expression to get a list of all strings inside
backticks` let fieldNamesInQuery = queryString.matchAll(/([^
]+)/g);
cannot use underscore '_' in the column header