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..
please use ruby zip <1.0.0 version in your Gemfile add
gem 'rubyzip', '< 1.0.0'
Please restart after bundle install
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.