Hi,
are u sure about your file name, I had this type of problem when my file name or sheetname cross length (~36 char) .
I am using "openpyxl " module to work with Excel file and I found its really helpful and compatible with excel-
here are the sample, may help you
#---------------------------------------------------------------------------
import openpyxl
def openmyExcel():
workbookObj = openpyxl.load_workbook("C:\TC_Python\Test1.xlsx")
worksheetobj = workbookObj.get_sheet_by_name('Sheet1')
rowcout = worksheetobj.max_row
colCount = worksheetobj.max_column
Log.Message(rowcout)
Log.Message(colCount)
#-----------------------------------------------------------------------------
def readCellData():
workbookobj = openpyxl.load_workbook("C:\TC_Python\Test1.xlsx")
worksheetObj = workbookobj.get_sheet_by_name("Sheet1")
rowcount = worksheetObj.max_row
colcount = worksheetObj.max_column
for introw in range(1,rowcount):
celldata = worksheetObj.cell(row = introw ,column =1).value
Log.Message(celldata)
#-----------------------------------------------------------------------------
def readAlldatainExcel():
wbo = openpyxl.load_workbook("C:\TC_Python\Test1.xlsx")
wso = wbo.get_sheet_by_name("Sheet1")
intAllRow = wso.max_row
intAllCol = wso.max_column
for introw in range(1, intAllRow):
for intcol in range(1,intAllCol):
mydata= wso.cell(row= introw, column = intcol).value
#Log.Message(mydata)
if (mydata == None):
break
Log.Message(mydata)
#----------------------------------------------------------------------------------
def writeinExcel():
wbo = openpyxl.load_workbook("C:\TC_Python\Test1.xlsx")
wso = wbo.get_sheet_by_name("Sheet1")
intAllRow = wso.max_row
intAllCol = wso.max_column
for introw in range(1, intAllRow):
for intcol in range(1,intAllCol):
wso['A1'] = introw
mydata= wso.cell(row= introw, column = intcol).value
Log.Message(mydata)
if (mydata == None):
break
Log.Message(mydata)
#----------------------------------------------------------------------------------
def getSheetName():
wbo = openpyxl.load_workbook("C:\TC_Python\Test1.xlsx")
wso = wbo.get_sheet_names()
for shname in wso:
Log.Message(shname)