Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Zeno R.R. Davatz
RE: Problem updating Excel Files [ reply ]  
2011-07-27 17:02
Can we please move this discussion to here:

http://groups.google.com/group/rubyspreadsheet

Have you tried saving your exfile.xls with OpenOffice and then modifying it with spreadsheet?

Does that work? In case not, please upload your sample code and exfile.xls to github and link it your Email to

http://groups.google.com/group/rubyspreadsheet

Best
Zeno

By: S Sharma
Problem updating Excel Files [ reply ]  
2011-07-27 15:29
I have an Excel workbook with 10 worksheets, created on Excel 2007 - saved in "xls" format (97-2003 format)
I would like to update them with data I pull from another source.

I can open the workbook and update the data in the spreadsheets but when I read them from Excel (2007/2010) I get errors.

1. If I touch all 10 worksheets, Excel-2007 complains that name of the last worksheet needs to be recovered -- all else is fine.
-- If I open the same file in Mac Excel-2008 -- it doesn't complain at all -- it read the correctly updated name on all sheets.

2. If I touch only a few worksheets -- Excel-2007 complains data loss -- no data is actually lost, but all the formatting is lost! (sheet names are fine).
-- If I try to open this file in Mac Excel 2008, it barfs and won't open it!

Code is:
eBk = Spreadsheet.open "exfile.xls"

for cnt in 0...10
sh = eBk.worksheet cnt

sh[1,1] = 'abc'
sh.name = cnt.to_s
end

eBk.write "newfile.xls"

Any hints or suggestions will help - I have spent 2 days on it and can't get anywhere.

Running on Ruby 1.8.7, Spreadsheet 0.6.5.7 on ubunut 10.4