I would like to go to each excel file and in that specific sheet, find the text "Sen's slope:" and break the loop to find the row and column and then print the value adjacent to that text.
could anyone help me where i'm wrong in this code.? any help is appreciated.
import os
from xlrd import open_workbook
excelfiles=[]
for i in os.listdir(os.getcwd()):
if '.xlsm' in i:
excelfiles.append(i)
cannotfiles=[]
slope=[]
for f in excelfiles:
print f
wb = open_workbook(f)
sheet = wb.sheet_by_name('Mann-Kendall trend tests')
j=0
for j in range(0,50):
i=0
for i in range(0,50):
print sheet.cell(i,j).value
if sheet.cell(i,j).value == "Sen's slope:":
break
print sheet.cell(i,j+1).value
Thanks