The Ruby Spreadsheet

Getting Started with Ruby Spreadsheet


http://spreadsheet.rubyforge.org/files/GUIDE_txt.html

To get started with Ruby Spreadsheet hit the above link.

18 Comments »

  1. THis could be useful if that link would be live.. jeeesus what a documentation is this? I need information about this spreadsheet gem and it’s soo hard to get it :/

    Comment by LUbomir Herko — May 24, 2010 @ 4:45 pm

  2. Maybe this is what you looking for (http://spreadsheet.rubyforge.org/GUIDE_txt.html)

    Comment by Foton — June 4, 2010 @ 3:09 pm

  3. Sorry for the bad documentation. We are working on it to improve it.

    Comment by zdavatz — December 7, 2010 @ 3:00 pm

  4. Why on earth did you move away from github? source and really hard to find.

    Comment by Charles Lowell — December 15, 2010 @ 10:09 pm

  5. We never where on Github. See http://spreadsheet.rubyforge.org/ the source is and was always here: http://scm.ywesee.com/?p=spreadsheet/.git;a=summary

    The new gem is out as well.

    Comment by zdavatz — December 16, 2010 @ 7:17 am

  6. Anybody have problems after reading a file and then the file is locked? I cant seem to find anything in the documentation about closing the workbook or the file.

    importPath = File.join(RAILS_ROOT, ‘temp_uploads’, “temp.xls”)
    book = Spreadsheet.open “#{importPath}”
    sheet = book.worksheet 0
    counter = 0
    sheet.each do |row|
    if counter > 0
    newBike = bike_from_row(row, counter)
    end
    counter += 1
    end

    Comment by Ethan — February 8, 2011 @ 5:14 pm

  7. Hi,

    I want to use Spreadsheet to collate a bunch of sheets, so that I copy rows from x number of sheets and dump them into newly created sheets based on certain criteria.

    Opening, reading, extracting the rows, and the initial creation of the ‘dump’ sheets is not a problem (all nice and easy), but when Spreadsheet opens a sheet created with Spreadsheet and inserts a row, then writes the file, I am no longer able to open the spreadsheet with either excel or open office – when I try I get an invalid file format message.

    I don’t get any errors when running my cukes (apart from trying to open the files manually later), but when I run the program from the cmd line, I get the following runtime error:

    /.rvm/gems/ruby-1.9.2-p290@account_manager/gems/spreadsheet-0.6.5.7/lib/spreadsheet/excel/workbook.rb:60:in `block in biff_version’: Unkown BIFF_VERSION ” (RuntimeError)

    If I start an IRB session and try to open the sheet with Spreadsheet, I get the same error.

    I presume I am missing something when it comes to writing the file a second time?

    Any ideas?

    Many Thanks

    Paul

    Comment by Paul Hollyer — September 4, 2011 @ 7:59 pm

    • Did you search the mailing list http://groups.google.com/group/rubyspreadsheet? This is a known “feature”. Modifying an XLS with several worksheets will result in not being able to open the modified file if you only modify one worksheet but do not rewrite the untouched worksheets (the ones that you did not modify). All worksheets have to be rewritten (or deleted if empty) if you modify a file with the spreadsheet gem.

      Comment by zdavatz — September 5, 2011 @ 8:54 am

  8. Thanks for the reply, you’re right, I should have gone to the group…

    Each created XLS file only has one worksheet, and after opening I am simply appending another row then writing the file.

    I’ll do a bit more digging, and post on the group if necessary.

    Thanks

    Comment by Paul Hollyer — September 13, 2011 @ 2:00 pm

    • Just in case anyone else comes across this, I found my problem – I was writing to the same file because I need to maintain the file names and locations, then I read in the help files that it wasn’t a good idea to do that!

      The fix was to delete the file prior to writing.

      I have added a Gist here [1] for anyone else to have a look at for similar issues.

      Hope it helps others.

      Paul

      [1] https://gist.github.com/1214475

      Comment by Paul Hollyer — September 13, 2011 @ 5:48 pm

  9. I’m trying to use spreadsheet to read from an xls doc and write the contents to an html file. The writing to html file part, I’ve got, but I’m having trouble getting the exact row and columns I need stored into a variable so I can write with it. Any help getting rows and columns would be appreciated.

    Comment by rai — February 13, 2012 @ 6:00 pm

    • book = Spreadsheet.open ‘\some\path\to\file.xls’
      current = book.worksheet 0
      Or if you want
      current = book.worksheet ‘SheetName’
      then
      rowC = current.row(2)
      Now you have an array to work with. Column 1 is then rowC[0], column 2 is rowC[1], etc
      Convert as necessary.

      Comment by t4t0nk4 — March 20, 2013 @ 10:21 pm

  10. hello, rubyforge is not available now. i need doc

    Comment by Kostyarin Ivanoff — June 9, 2014 @ 10:04 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: