From: Venkat r m Reddi Date: 2009-12-30T18:24:43+09:00 Subject: Re: ruby/ole excel delete row? thanks for your reply....but here this solution could not helps me much...i need to run loops to the column data...below is my testdata which is in a single lengthy row.... http://gmail.com pageTitle:Login user1 pwd1 user2 pwd2 user3 pwd3 DB1 DB2 DB3 I know my script is wrong, which was written as below...i want to use xls class... begin xlFile = XLS.new("Dir.getwd + '/TestData.xls") myData = xlFile.getColumnRecords("A1:AZ1", "Sheet1") # here i have no idea whether to use getRange or getHash or getRowRecords or any other..... ensure xlFile.close end myData.each do |r| puts r["user"] puts r["pwd"] # end end ...i want to iterate from user1:pwd1, user2:pwd2, user3:pwd3...and again to iterate db1, db2, db3 like that... your help is greatly appreciated.... thanks, venkat David Mullet wrote: > Eric Ching wrote: >> How do I delete a row in an excel spreadsheet with win32ole? >> >> I want to loop through some rows and delete a row if a cell in the row >> contains a certain value. >> >> Here's the loop I am using: >> >> excel.Range("h2:h305").each do |cell| >> if cell.Value == "blah" >> # DELETE ROW HERE >> end >> end >> > > (2..305).each do |row| > if worksheet.Range("H#{row}").Value == "blah" > worksheet.Rows(row).Delete > redo > end > end > >> >> And,where can I find documentation for using win32ols with excel. I've >> been looking but haven't found anything to my satisfaction. >> > > http://rubyonwindows.blogspot.com > http://rubyonwindows.blogspot.com/search/label/excel > > David -- Posted via http://www.ruby-forum.com/.