Reputation:
In google sheets, I am trying to find many strings and highlight them, so say, "Find", "Find2", "Find3", "Find4". Please see below.
cell_list = worksheet.findall("find", "find2", "find3", "find4")
Upvotes: 0
Views: 42
Reputation: 201428
In that case, how about the following modification?
cell_list = worksheet.findall("find", "find2", "find3", "find4")
regex = re.compile("find|find2|find3|Find4")
cell_list = worksheet.findall(regex)
and
regex = re.compile("find(\d+)?", re.IGNORECASE)
cell_list = worksheet.findall(regex)
In this modification, the regex is used for findall
.
gspread API Reference - findall
Upvotes: 1