Searching the string and getting the row and column value
29,621
Solution 1
I think this is what you are looking for , Here you go,
from xlrd import open_workbook
book = open_workbook(workbookName)
for sheet in book.sheets():
for rowidx in range(sheet.nrows):
row = sheet.row(rowidx)
for colidx, cell in enumerate(row):
if cell.value == "particularString" :
print sheet.name
print colidx
print rowidx
best,
Solution 2
Say you're searching for a string s
:
for row in range(sh.nrows):
for column in range(sh.ncols):
if s == sh.cell(row, column).value:
return (row, column)
Author by
query
Updated on July 09, 2022Comments
-
query almost 2 years
How to search the particular string in the excel sheet and getting the row and column value of that particular string in the excel sheet using
xlrd
in python? Can any one help me please?import xlrd workbook = xlrd.open_workbook("1234.xls") worksheet = workbook.sheet_by_name('firstpage')
only this much i tried