Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'win32ole'
- puts "What is the name of the game you wish to get the info from?"
- name = gets.chomp
- while !File.exists(File.dirname(__FILE__) + name + '.rb')
- puts "There exists no file, #{name}, in this directory."
- name = gets.chomp
- end
- data_items = Marshal.load(File.dirname(__FILE__) + name, 'rb')
- excel = WIN32OLE.new('Excel.Application')
- excel.Visible = 1
- workbook = excel.Workbooks.Add
- worksheet = workbook.Worksheets(1)
- # workbook.createSheet("new sheet")
- worksheet.Name = 'Items'
- worksheet.Cells(1, 1).Value = "Name"
- data_items.each_with_index do |row, r|
- worksheet.Cells(r+2, 1).Value = field
- end
- end
- workbook.SaveAs(File.dirname(__FILE__) + "#{name}.xls")
- workbook.Close
- excel.Quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement