dimanche 22 décembre 2019

Python gspread CellNotFound exception error

I want to check whether if a cell value exists in my sheet. If the cell exists, it will return yes and if it doesn't, it will return no.

cell = sheet.find('test')
if cell.value =='test':
    print('Yes')
else:
    print('No')

The above code works for the true segment but does not work if false and it returns an error gspread.exceptions.CellNotFound: test. I tried adding an exception, except gspread.exceptions.CellNotFound: but it still does not work.

Any clue in whats wrong with this code?

Aucun commentaire:

Enregistrer un commentaire