问题
I would like to import rows from a sheet that exclude certains character. I did it first using the CONTAINS function but i didn't find a way to do it with multiple parameters. So i did it using the MATCHES function :
=Query(importrange("URL";"Sheet!a:be");"SELECT Col1, Col3, Col4, Col26, Col8, Col30, Col40, Col41, Col44, Col45, Col49 WHERE NOT Col8 MATCHES '.*alc.*|.*vin.*|.*alcool.*'")
however there is still rows where those strings appear in Col8, i don't know why ?
How could i do it in order to filter my import excluding those strings no matter what ?
回答1:
In case the rows are not filtered out because of MATCHES
is case sensitive (it is, and one cannot use flags in QUERY
's regex), you can use FILTER
instead:
=FILTER(
QUERY(
IMPORTRANGE("URL"; "Sheet!A:BE");
"SELECT Col1, Col3, Col4, Col26, Col8, Col30, Col40, Col41, Col44, Col45, Col49"
);
NOT(REGEXMATCH(IMPORTRANGE("URL"; "Sheet!H:H"); "(?i)alc|vin|alcool"))
)
来源:https://stackoverflow.com/questions/65169244/google-sheet-query-matches-function-doesnt-exclude-strings