When I tested all sheets in your sample Spreadsheet using ws.find(item, in_column = 6)
, I confirmed that an error occurred on the 1st sheet ("Info" sheet). Also, I confirmed that in your 1st sheet of "Info", the merged cells are existing. In this case, it seems that such an error occurs.
If you are not required to use ws.find(item, in_column = 6)
in the 1st sheet, as a simple modification, how about the following modification?
Modified script 1:
cell = None
wslist = hoards.worksheets()
for ws in wslist:
if ws.title != "Info":
cell = ws.find(knife, in_column=6)
if (cell != None):
worksheet = ws
print("found cell")
break
- This script excludes the sheet using the sheet name "Info".
Modified script 2:
cell = None
wslist = hoards.worksheets()
for i, ws in enumerate(wslist):
if i > 0:
cell = ws.find(knife, in_column=6)
if (cell != None):
worksheet = ws
print("found cell")
break
- This script excludes the sheet using the sheet index.
Note:
- This modified script can be used for your sample Spreadsheet. If your Spreadsheet is changed, this script might not be able to be used. Please be careful about this.