# File app/bin/excel_to_text.rb, line 47 def run(absolute_path) xl = WIN32OLE.new('Excel.Application') book = xl.Workbooks.Open(absolute_path) begin book.Worksheets.each do |sheet| if @sheetname == nil || sheet.Name == @sheetname print_title(sheet.Name) sheet.UsedRange.Rows.each do |row| record = [] row.Columns.each do |cell| record << cell.Value end print_str(record.join(",")) end end end ensure book.Close xl.Quit end end