Spreadsheet gem errors

I am using the spreadsheet gem to try to create workbook by copying the
first worksheet

work_book = Spreadsheet.open ‘./test.xls’
sheet = work_book.worksheet 0

sheet2 work_book.add_worksheet(sheet)
sheet.name = “copy”

workbook.write(’./test.new.xls’)

I get a corrupt file with the following with the following log:

Microsoft Office Excel File Repair Log

Errors were detected in file
‘C:\programming\ruby\circuits\lib\circuits\ZLC_BZN.Site.Specific.Requirements.2010-10-21.xls’
The following is a list of repairs:

Damage to the file was so extensive that repairs were not possible.
Excel
attempted to recover your formulas and values, but some data may have
been
lost or corrupted.

does the add_worksheet function work and am I using it right?

Thanks,

dominic

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs