5
Hi, how are you? I am a beginner in Python and would like to run a script that given a spreadsheet in excel, the user could search a word inside this spreadsheet (input) and if the word was found to return "File Found and display all lines. For example, my spreadsheet:
Name Age height Danilo 27 1.62 John 35 1.75 Mary 23 1.85 Thalita 25 1.80
The user seeking Danilo, would like the program to return: File Found and Name Age height Danilo 27 1.62
Follows my code:
from xlrd import open_workbook
workbook = open_workbook("c:/Python34/test.xlsx")
sheet = workbook.sheet_by_index(0)
prompt = '>'
print ("Entre com o termo a ser buscado: ")
item = input(prompt)
found = False
for cell in sheet.col(0):
if cell.value == item:
found = True
if found == True:
print('Arquivo Encontrado', item) # tentei colocar (cell) mas dá errado
else:
print('Arquivo não Encontrado')
Thank you very much
Hello, thank you so much for the help. I’ll try the suggestion, abç
– Tiago Corrêa