Tuesday, 10 September 2013

Parsing xlsx file using 'roo' gem, Load Error: can not load zip/zipfilesystem

Parsing xlsx file using 'roo' gem, Load Error: can not load zip/zipfilesystem

On Ubuntu machine, following code works fine,
My HTML code, here am passing xslx file for parsing,
<form method="post" action="/home/parse_xlsx" enctype="multipart/form-data">
Upload XSLX File <input type="file" name="xlsx_file" id="xlsx_file" />
<input type="submit" value="Post"/>
</form>
My controller method,
def parse_xlsx
xlsxFile = params[:xlsx_file]
prefix_tmp_path = xlsxFile.path
filename = xlsxFile.original_filename
directory = "public/"
path = File.join(directory, filename)
File.open(path, "wb") { |f| f.write(xlsxFile.read) }
require 'roo'
s = Roo::Excelx.new(path)
for i in 2..s.count
puts s.cell(i,1)
end
end
But on windows machine it gives me following error. 'rubyzip' gem is also
included.
Load Error: can not load zip/zipfilesystem
Please suggest some solution..

No comments:

Post a Comment