I had to make an estimation about the open bugs for a project in bugzilla and just had the long format list of bugs. I started by copying the values from the HTML page manually into a spreadsheet. As I reached the middle of the list I thought it would be better to automate that.
Writing a program to do it is way better than doing it by myself.
# parses a bugzilla search result list in long format
# and creates a csv file
require 'rubygems'
require 'nokogiri'
require 'fastercsv'
f = File.open("show_bug.htm")
doc = Nokogiri::HTML(f)
f.close
FasterCSV.open("bugs.csv", "w") do |csv|
doc.css("h1").each do |bug|
bug_number = bug.css("a").text
tbody = bug.next_sibling.next_sibling
bug_description = tbody.css("td").first.text
csv < < [ bug_number, bug_description]
end
end