require 'nokogiri' require 'open-uri' require 'spreadsheet' #Create the Spreadsheet Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet sheet1.name = 'My First Worksheet' #Specify our URI %w[ http://www.asus.com/Notebooks_Ultrabooks/S56CA/#specifications http://www.asus.com/Notebooks_Ultrabooks/ASUS_TAICHI_21/#specifications ].each do |url| doc = Nokogiri::HTML(open(url)) #Grab our product specifications data = doc.css('div#specifications div#spec-area ul.product-spec li') #Modify our data lines = data.map(&:text) #Output our data to the Spreadsheet lines.each.with_index do |line, i| a = 0 a+=1 sheet1[i, a] = line end end book.write 'C:/Users/Barry/Desktop/output.xls'