Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.72 KB | None | 0 0
  1. require 'win32ole'
  2.  
  3. puts "What is the name of the game you wish to get the info from?"
  4. name = gets.chomp
  5. while !File.exists(File.dirname(__FILE__) + name + '.rb')
  6.   puts "There exists no file, #{name}, in this directory."
  7.   name = gets.chomp
  8. end
  9.  
  10. data_items = Marshal.load(File.dirname(__FILE__) + name, 'rb')
  11.  
  12. excel = WIN32OLE.new('Excel.Application')
  13. excel.Visible = 1
  14. workbook = excel.Workbooks.Add
  15. worksheet = workbook.Worksheets(1)
  16. # workbook.createSheet("new sheet")
  17. worksheet.Name = 'Items'
  18. worksheet.Cells(1, 1).Value = "Name"
  19. data_items.each_with_index do |row, r|
  20.     worksheet.Cells(r+2, 1).Value = field
  21.   end
  22. end
  23.  
  24. workbook.SaveAs(File.dirname(__FILE__) + "#{name}.xls")
  25. workbook.Close
  26. excel.Quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement