psharma
psharma

Reputation: 1289

How do I export an array output of a CSV in ruby to html?

below is my ruby script

require "rubygems"
require 'csv'

a = Array.new
CSV.foreach("p34n234.csv") do |row|
    a << row
end

print a

What i want to do is now at the end I want to generate a html file and print array to it.

I hope i made sense.

Thanks

P.S I just want to show the array in a .html file. Nothing fancy here:)

Upvotes: 0

Views: 52

Answers (1)

Bala
Bala

Reputation: 11274

I guess you would be doing something like this...

print "HTTP/1.0 200 OK\r\n"
print "Content-type: text/html\r\n\r\n"
print "<html><body>#{your_array}</body></html>\r\n"

Upvotes: 1

Related Questions