Reputation: 1326
I want to read excel file, I use follow code to open excel:
file = Roo::Spreadsheet.open(file_path)
But when file_path
contain japanese,error occur:
URI::InvalidURIError: URI must be ascii only "/Users/myname/Project/Test/tmp/data/\u{611b}\u{77e5}\u{770c}/s000226.xlsx"
I tried URI to parse file_path
but not work.
How to fix it? Thanks you.
Upvotes: 3
Views: 1255
Reputation: 8646
You can try
File.open(path, 'rb') do |file|
xlsx = Roo::Spreadsheet.open(file, extension: '.xlsx')
end
Upvotes: 2