Unable read excel file with xlrd package
Hi: I wrote a code in python to read excel file (.xlsx).
Used the import package xlrd. Placed the appropriate package in C:\Program Files (x86)\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib
import xlrd code works fine but Test complete doesnot recognize attribute open_workbook.
Code works fine in Python IDLE but Test Complete does not recognize this attribute.
def xlrd_package_check():
import xlrd
path='C:\\Users\H191725\Desktop\\readwritepython.xlsx'
book=xlrd.open_workbook(path)
# The above line has issue
# print number of sheets
Log.message(book.nsheets)
# print sheet names
message(book.sheet_names())
# get the first worksheet
first_sheet = book.sheet_by_index(2)
# read a row
Log.message(first_sheet.row_values(0))
# read a cell
cell = first_sheet.cell(0,0)
Log.message(cell)
Log.Message(cell.value)