From: "Rafael G." Date: 2006-08-10T17:34:17+09:00 Subject: Re: Entering data into Excel, in specific iterated rows/columns reed.adam@gmail.com wrote: > > I have a script that spiders a page looking for elements. In this > specific case, I'm looking for links (innerText and href). > > I have this script working so far to output data to a text file, but > I'd like to output it to an Excel file for organization. I'm getting > stuck however trying to think of the correct method to put all of the > link.innerText values into A1, A2, A3, etc and the corresponding > link.href into B1, B2, etc. > > Here is the code I have so far (with the normal text file code in place > of the excel code I have yet to think of): > > ef grab_links(url) > $ie.goto(url) > excel = WIN32OLE.new("excel.application") > excel.visible = true > workbook = excel.workbooks.add > workbook.saveas("#{Project}_links.xls") > workbook.close > > linkfile.puts "\n#{url}" > $ie.links.each{|link| > linkfile.puts("#{link.innerText} - #{link.href}") unless > link.innerText.empty? > } > > linkfile.puts "\n\n" > end > > One big file with it formatted like this would be fine, or even a > different worksheet for each URL would be great. I'm not really > concered with that. Can you guys give me hand? > > Thanks! > > > > Try with Spreadsheet::Excel It let you create worksheets, write in a defined column - row, ... Regards! -- View this message in context: http://www.nabble.com/Entering-data-into-Excel%2C-in-specific-iterated-rows-columns-tf2081687.html#a5740447 Sent from the ruby-talk forum at Nabble.com.