I want to access the cell which has formula from the excel workbook. I have a script that is working fine but only read the data from excel.
I only need to print the cells with formula. An example would be really appreciated.
I want to access the cell which has formula from the excel workbook. I have a script that is working fine but only read the data from excel.
I only need to print the cells with formula. An example would be really appreciated.
How about this below function:- Input Parameter you need to pass in the below function like that below:-
Input Parameter:- validateExcelData("Desktop/test.xls,55")
Note:- Here 55 is the count using formula, for this below if condition will not work and you will get the result fail, but if the integer value is without formula then if condition will work and result you will get pass. Also this is not the efficient code. Just look if it helps:)
def validateExcelData(input):
inputParam=input.split(",")
filePath=inputParam[0].strip()
value=inputParam[1].strip()
outputParams="Fail"
try:
fs = os.sep.join((os.path.expanduser("~"),filePath))
wb=xlrd.open_workbook(fs)
for s in wb.sheets():
for row in range(s.nrows):
for col in range(s.ncols):
if s.cell(row,col).value==int(value):
outputParams ="PASS"
break
except:
outputParams = GetException()
return outputParams