The Ruby Spreadsheet

October 20, 2011

Modifying an exiting Workbook with several Worksheets with the Ruby spreadsheet library

Filed under: Workbook, Worksheet — Tags: , , — zdavatz @ 6:22 am

This question has been asked many times on the mailing list:

I have an Excel file (workbook) with many worksheets in it. Now I modify one worksheet but leave the other worksheets untouched. When I write the file and then try to open it with OpenOffice or Microsoft Office the file hangs. What do I have to do?

1. You need to write the modified file to a new file name.

2. If the Workbook contains empty sheets, delete the empty sheets from the source file. There is no point in carrying empty sheets around.

3. If the Workbook contains 1 sheet that you want to modify but you want to leave the other worksheets untouched because they contain data, then read the following post from John Smith (very smart guy).

http://groups.google.com/group/rubyspreadsheet/browse_thread/thread/f5bc157b06b66604

4. If you find a better solution, let me know via the list – and do not forget to post your sample code to github (please do not post it in the mail).

Create a free website or blog at WordPress.com.