Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## LoadDataTest.rb
- # K:\_Projects\Ruby\_Rails_Apps\PayrollLoader
- require 'win32ole'
- csvFile = DATA.read.chomp
- puts csvFile, ""
- excel = WIN32OLE.new('Excel.Application')
- # Previously, tried: F:\Docume~1\AllUse~1\StartM~1\Programs\_Microsoft\Micros~3\Micros~2.lnk
- puts "", "==== Get Excel methods ====", ""
- puts excel.ole_get_methods # -- worked fine also
- # Displays "open" method:
- puts "", "==== Get Excel methods ~ /Op/ ====", ""
- excel.ole_methods.each { |meth| puts meth if meth.to_s =~ /Op/i } # -- returned nothing
- # Try to find an "open" method by sorting methods:
- puts "", "==== Get Excel methods, sorted ====", ""
- # puts (excel.ole_methods.each { |meth| meth.to_s}).sort
- puts "Failed with: undefined method `<=>' for ShortcutMenus:WIN32OLE_METHOD (NoMethodError)"
- puts "", "==== Get Excel methods, sorted more simply====", ""
- puts excel.methods.sort # -- worked fine
- puts "", "==== Try opening a CSV file ====", ""
- system( "csvFile" ) # Couldn't open the document
- puts "system(\"csvFile\") returned nothing"
- puts "==== EOJ ===="
- __END__
- K:\_Projects\Ruby\_Rails_Apps\PayrollLoader\TestSheet.csv
Add Comment
Please, Sign In to add comment