The Ruby Spreadsheet

February 13, 2009

0.6.3.1 Ruby Spreadsheet released

Filed under: Release, Ruby, Spreadsheet — Tags: — zdavatz @ 3:02 pm

*   Reduce warnings produced by running under ruby -w
*   Improved auto-formatting for Dates and Times
*   Honor Row, Column, Worksheet and Workbook-formats
*   Merge branch ‘master’ into HEAD
*   Only select the First Worksheet by default

http://scm.ywesee.com/?p=spreadsheet/.git;a=summary

Advertisements

1 Comment »

  1. I wonder why when passing a hard-coded String to read an Excel file on Windows network works fine:

    #encoding: utf-8
    require ‘spreadsheet’

    folder = “\\\\server100\\folder1\\folder2”
    file = folder << "\\" << "olé-olé-file.xls"
    Spreadsheet.client_encoding = 'UTF-8'
    Spreadsheet.open(file) do |book|
    puts "sheets: #{book.worksheets.size}"
    sheet = book.worksheet(0)
    puts "First sheet name: #{sheet.name}"
    end

    But when I pass the same file name from a variable, it doe not work:

    require 'spreadsheet'

    folder = "\\\\server100\\folder1\\folder2"
    pattern = "ole-olé-*.xls"
    Dir.chdir(folder)
    source_files = Dir.glob(pattern)
    recent_file = source_files.max_by { |f1| File.mtime(f1) }
    file = folder << "\\" << recent_file

    Spreadsheet.open(file) do |book|
    puts "sheets: #{book.worksheets.size}"
    sheet = book.worksheet(0)
    puts "First sheet name: #{sheet.name}"
    end

    The error I get is the following:

    C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet/excel/reader.rb:1172:in `setup': undefined method `read' for false:FalseClass (NoMeth
    odError)
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet/excel/reader.rb:121:in `read'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet/excel/workbook.rb:32:in `open'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet.rb:62:in `open'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet.rb:65:in `block in open'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet.rb:64:in `open'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/spreadsheet-0.6.8/lib/spreadsheet.rb:64:in `open'

    It happened on Windows XP SP3 box, Ruby 1.9.3, spreadsheet 0.6.8
    Thank you

    Comment by belgoros — March 26, 2012 @ 11:27 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: