Skip to content

Instantly share code, notes, and snippets.

/table.rb Secret

Created January 4, 2017 01:09
Show Gist options
  • Save anonymous/c86bb5ff9d460de0b529a25592759dad to your computer and use it in GitHub Desktop.
Save anonymous/c86bb5ff9d460de0b529a25592759dad to your computer and use it in GitHub Desktop.
require 'nokogiri'
require 'csv'
doc = Nokogiri::HTML(open('p100'))
csv = CSV.open("output.csv", 'w',{:col_sep => ";", :quote_char => "\"", :force_quotes => true})
doc.css('#myForm table tr').each do |row|
tarray = []
row.css('td').each do |row|
tarray << row
end
csv << tarray
end
csv.close
csvread = CSV.read('output.csv',{:col_sep => ";", :quote_char => "\"", :force_quotes => true})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment