Hi-

Could someone help me figure out how to skip over blank Excel rows
(where the first item in the array is "" or length=0) and continue to
the next row?  I use xls.rb ( 
http://wiki.openqa.org/display/WTR/Excel+interface+class
) to read Excel workbook cells that each contain a formula, where
everything defaults to "" or zero length blank.

Here's a sample xls (note how second to the last row appears blank):
Import
WHERE   WHAT
Account1        Apple

Account3        Orange



Here's a snippet of my code:

require 'xls'
require 'rubygems'
require 'watir'

ie = Watir::IE.attach(:url, 'http://www.blah.com) #reuse existing
browser window

#Open Excel file, Import worksheet
xlFile = XLS.new('C:\MyFile.xls') #grab the data file
myData = xlFile.getRowRecords('Import','Import')  #pull data records
from Excel
xlFile.close

myData.each do |record|

  #need something that says if record['WHERE'] = "" or 0 length then
skip to next row
  ie.frame(:name, "main").text_field(:name,
'account').set(record['WHERE'])
  ie.frame(:name, "main").text_field(:name,
'item').set(record['WHAT'])

end

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to