Forum Discussion

dhirendranaga's avatar
dhirendranaga
Occasional Contributor
9 years ago

Excel Reading Using Python code

Hi,

 

I am using below code to read Excel using Python code and at end using Quit() to close the object. But even after successfull execution of code, there is one Excel.Exe process in Task Manager. Please suggest whether this is issue with my code or TestComplete with Python.

 

def loadExcel(vExcelFilePath):  

 try :

   oExcel = Sys.OleObject["Excel.Application"]

      oExcel.Workbooks.Open(vExcelFilePath)

  

      vRowCount = oExcel.ActiveSheet.UsedRange.Rows.Count

      vColumnCount = oExcel.ActiveSheet.UsedRange.Columns.Count  

 

      oExcel.Quit()

     

   except Exception as e:

    Log.Warning("Exception caught in loadExcel() : ",str(e))

        oExcel.Quit()

 

Tried oExcel.Workbook.Close() before Quit(), but says no such property/method supported for object.