zdavatz / spreadsheet

The Ruby Spreadsheet by ywesee GmbH
http://spreadsheet.ch
GNU General Public License v3.0
1.13k stars 240 forks source link

Error opening a spreadsheet created by this gem #262

Closed Ramyani-QI closed 3 years ago

Ramyani-QI commented 3 years ago

Ref: https://github.com/zdavatz/spreadsheet/issues/138 Seems this issue is still reproducible.

I have tried with the same test script:

  def test_append_and_reopen
    puts "Testing append and reopen"
    filename = 'test.xls'
    sheet_name = 'Test Sheet'

    # Create excel
    excel = Spreadsheet::Workbook.new(filename)
    sheet = excel.create_worksheet(name: sheet_name)
    sheet.row(1).replace ['Data']
    excel.write(filename)

    # Append something
    excel = Spreadsheet.open(filename, 'a+')
    sheet = excel.worksheet(sheet_name)
    sheet.row(2).replace ['Data2']
    excel.write(filename)

    # Reopen
    excel = Spreadsheet.open filename # Crashes here
    sheet = excel.worksheet sheet_name
  end

Can anyone help on this issue? Thanks.

zdavatz commented 3 years ago
  1. Did you try this solution: https://github.com/zdavatz/spreadsheet/issues/138#issuecomment-129503648?
  2. Which version of Ruby are you using?
  3. Which software created the Original file?
  4. Can you attach the file, that you are trying to open?
Ramyani-QI commented 3 years ago
  1. Yes tried that solution and the error is reproducible. Error: Unkown BIFF_VERSION '' spreadsheet-1.2.9/lib/spreadsheet/excel/workbook.rb:59:in `block in biff_version'
  2. Using jruby-9.2.18.0
  3. I had created the file test.xls using the same spreadsheet script only
  4. test.xls
zdavatz commented 3 years ago

Can you try with Ruby 3.0.0?

Ramyani-QI commented 3 years ago

I have tried with ruby-3.0.0 but getting same error Error: Unkown BIFF_VERSION '' spreadsheet-1.2.9/lib/spreadsheet/excel/workbook.rb:59:in `block in biff_version'

zdavatz commented 3 years ago

Ok, this should work now. Please let me know if you experience further problems.