ruby - Unable to convert .xls to .csv using Roo -
goal code process .xls files in directory , convert them .csv. has worked in past after updating ruby , roo showing error below. using ruby 1.9.3-p362 , roo 1.11.2.
require 'rubygems' require 'csv' require 'iconv' require 'mysql2' require 'mysql' require 'roo' begin dir["#{@work_path}/*.xls"].each |file| begin file_path = "#{file}" file_basename = file.basename(file, ".xls") xls = excel.new(file_path) xls.to_csv("#{@kenshoo_work_path}#{file_basename}.csv") @log.info("converted file #{file}") fileutils.remove(file) @log.info("deleted file #{file}") rescue exception => e @log.warn("unable convert file: #{file_basename} csv because #{e.message}") end end end
for every file following error message:
unable convert file: #{file} csv because uninitialized constant excel
any appreciated. thanks.
roo
has excel
class within roo::
namespace. need replace instances of excel
roo::excel
the older versions did not namespace classes under roo::
, explain why code broke after update.
the new repository here: https://github.com/empact/roo
Comments
Post a Comment