# Too many number of excel processes are shown in the process

**URL:** <https://www.ruby-forum.com/t/too-many-number-of-excel-processes-are-shown-in-the-process/90380>\
**Category:** Ruby\
**Created:** [March 28, 2007, 10:26am UTC](https://www.ruby-forum.com/t/too-many-number-of-excel-processes-are-shown-in-the-process/90380 "2007-03-28T10:26:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [March 28, 2007, 10:26am UTC](https://www.ruby-forum.com/t/too-many-number-of-excel-processes-are-shown-in-the-process/90380/1 "2007-03-28T10:26:28Z")

</div>

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…  
code

count=100  
i=0  
while i\<count  
i=i+1  
begin  
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  
rescue  
excel.Quit()  
ensure  
excel.Quit() unless excel.nil?  
end  
end

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.

---

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [March 28, 2007, 3:26pm UTC](https://www.ruby-forum.com/t/too-many-number-of-excel-processes-are-shown-in-the-process/90380/2 "2007-03-28T15:26:57Z")

</div>

You might try calling excel.ole\_free after you call excel.Quit()…
