Hello, anyone can help me with parsing an html table data to be saved directly in an excel file from the same parsing app?

What do you mean by that? You mean using a ruby script to read data from a HTML file, and then create an excel file from it? To read in a HTML file, you simply open the file and read the content using File class. To parse it, you could simply use scan() method of String class (could do it in many ways). Then to create an excel file (regardless the format), you could use SpreadSheet plug-in.

for your version I need to have the html file saved locally? i wanted to pass the url to the script and then make it fetch the data to be stored.

If you want to fetch directly from a URL, you need 'net/http' module to handle the connection & retrieve the HTML page data from the selected URL. The return value would be string.

=begin
i.e.
require "net/http"
domain = "www.adomain.com"
page = "/asub/page.html
http = Net::HTTP.new(domain, 80)
data = http.get(page, nil)  # page content
body = page_data.body  # this is the whole HTML string
=end

Then you deal with the string the same way you deal with the content read from a file. There is nothing different here.

Err fixing my script above... The correct version should be as follows:

require "net/http"
domain = "www.adomain.com"
page = "/asub/page.html"
http = Net::HTTP.new(domain, 80)
data = http.get(page, nil)  # page content
body = data.body  # this is the whole HTML string
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.