Forum: Ruby Too many number of excel processes are shown in the process

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
87303c28b23af9aa69831b6bd156fdb0?d=identicon&s=25 Ruhul Amin (tuhin_cse99)
on 2007-03-28 10:26
hi guys,
      I want to read some data from each of the files from a directory
and save it to database.In the time of read operation each excel file is
open but not close after read from the file. After processing of all
files the excel is closed.
here is the code..

while i<count
excel = WIN32OLE::new('excel.Application')   # create winole Object
    workbook = excel.Workbooks.Open("#{path}") # Open the Excel file
    worksheet = workbook.Worksheets(1) #get hold of the first worksheet
    worksheet.Select      # select the worksheet
    title = worksheet.Range('h3')['Value']  #get value of title
    excel.ActiveWorkbook.Close(0)    # close the workbook
    excel.Quit()       #  close Excel file
     excel.Quit() unless excel.nil?

code end

For 50/100 or more files, too many number of excel processes are shown
in the process list of Test manager.The cpu utility becomes 100% and
memory(RAM) becomes full and computer becomes very slow, almost hung.

Please review the code where I made mistake.

please help me.
8bc543795b502900b5333aea73ad5533?d=identicon&s=25 Eden Li (edenli)
on 2007-03-28 15:26
(Received via mailing list)
You might try calling excel.ole_free after you call excel.Quit()...
This topic is locked and can not be replied to.