From: Sybren Kooistra Date: 2012-09-09T07:29:28+09:00 Subject: Re: Parsing through downloaded html Well, this topic took an interesting turn =) Ivan, thanks for the 'spreadsheet' tip + code. I got me a lot further, but I´m still running into some walls. Mostly, at the moment I need to know how to specify column and row for variables: in a way that for every next document I parse the variables will be put in the same columns, but the next row. so column a, column b first document: variable 1 = column a, row 1 | variable 2 = column b, row 1 second document: variable 1 = column a, row 2 | variabele 2 = column b, row 2. etcetera. the code so far: # First the basic code, including the opening of a new spreadsheet: require 'nokogiri' require 'spreadsheet' Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet # Now to parse through all downloaded .htmls: Dir.chdir(“anattempt”) Dir.glob['*.html'].each do |document| f = file.open(document) searchablefile = Nokogiri::HTML(f) variabelebasedonaxpath = searchablefile.xpath("//h1[contains(text(), 'Harbers']") # Now to save the variable(s) in the spreadsheet (..but how to?) row = ? (push ?) Column = ? (column.push ?) book.write 'htmltoexcel.xls' -- Posted via http://www.ruby-forum.com/.