file_path ='\\\\server100\\Folder1\\Folder2\\oléolé-file.xls'
Spreadsheet.client_encoding = 'UTF-8'
Spreadsheet.open(file_path) do |book|
puts "sheets: #{book.worksheets.size}"
sheet = book.worksheet(0)
puts "First sheet name: #{sheet.name}"
end
But when I tried to do almost the same, just searching the most recent
file and pass it to the Spreadsheet like that, it doesn't work. Ruby
replaces back slashes by forward ones what causes a problem on Windows
box:
''\\\\server100\\Folder1\\Folder2'
should be
'\\\\server100\\Folder1\\Folder2'
without the double '' at the start
···
On 26/03/2012 9:18 PM, Serguei Cambour wrote:
I can't figure out why the below code works fine:
#encoding: utf-8
require 'spreadsheet'
file_path ='\\\\server100\\Folder1\\Folder2\\oléolé-file.xls'
Spreadsheet.client_encoding = 'UTF-8'
Spreadsheet.open(file_path) do |book|
puts "sheets: #{book.worksheets.size}"
sheet = book.worksheet(0)
puts "First sheet name: #{sheet.name}"
end
But when I tried to do almost the same, just searching the most recent
file and pass it to the Spreadsheet like that, it doesn't work. Ruby
replaces back slashes by forward ones what causes a problem on Windows
box: