Error recovery when opening MS Excel:
Hi, using rubyXL, I am transforming an existing MS-Excel into a new one... When I open the new one, MS-Excel reports an error and tries to fix the errors...
Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. Removed Records: Named range from /xl/workbook.xml part (Workbook) Repaired Records: Cell information from /xl/worksheets/sheet7.xml part
The result of the recovery is stored in the file with the following content
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error018760_01.xml</logFileName><summary>Errors were detected in file 'C:\Users\Win10\Downloads\ZZZZZZZ.xlsx'</summary><additionalInfo><info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info></additionalInfo></recoveryLog>
I unzipped the contents of the original and transformed Excels and compared them (in meld), specifically I compared workbook.xml in both versions and I can see that under the <sheets> tag all "r:id" values are off by 5, i.e. if a sheet in the original version has r:id=X then in the transformed version it has r:id=(X + 5). I checked the rubyXL code and see that in ./lib/rubyXL/objects/relationships.rb:40 says
:id => "rId#{relationships.size + 1}"
and wonder how it could go wrong... obviously when writing out the file somehow
apriori relationships.size == 5
but I do not understand why? Do you have any idea?
Thanks.
I am also having this issue. I'm not even modifying the sheet, just reading it in and saving it to file without any changes:
puts 'READ'
workbook = RubyXL::Parser.parse("./assets_template_base.xlsx")
puts 'WRITE'
workbook.write("./assets_template_rubyxl.xlsx")
@andyzito RubyXL is not perfect, it's the best recreation we can do given the current technologies.
@kyalpani can you please provide the file you are having trouble with?
idk about @kyalpani, but I'm guessing my issue is related to https://github.com/weshatheleopard/rubyXL/issues/198. I'm hoping that the workaround suggested at the end of that issue (importing/exporting with RubyXL, repair with Excel, then use that repaired file as the new base file) will work for our use case 🤞
@weshatheleopard Thanks for maintaining a gem that can do both reading + writing for xlsx 😄
I will be glad to help you locate the problem. If there is specific information that you require, I can try to locate it. #198 is certainly related but reopening the excel was not an option in my case. Nonetheless, at least for Excels generated from scratch, RubyXL is an excellent tool.
Hi, using rubyXL, I am transforming an existing MS-Excel into a new one... When I open the new one, MS-Excel reports an error and tries to fix the errors...
Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. Removed Records: Named range from /xl/workbook.xml part (Workbook) Repaired Records: Cell information from /xl/worksheets/sheet7.xml part
The result of the recovery is stored in the file with the following content
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error018760_01.xml</logFileName><summary>Errors were detected in file 'C:\Users\Win10\Downloads\ZZZZZZZ.xlsx'</summary><additionalInfo><info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info></additionalInfo></recoveryLog>I unzipped the contents of the original and transformed Excels and compared them (in meld), specifically I compared workbook.xml in both versions and I can see that under the
<sheets>tag all "r:id" values are off by 5, i.e. if a sheet in the original version has r:id=X then in the transformed version it has r:id=(X + 5). I checked the rubyXL code and see that in ./lib/rubyXL/objects/relationships.rb:40 says
:id => "rId#{relationships.size + 1}"and wonder how it could go wrong... obviously when writing out the file somehow apriori
relationships.size == 5but I do not understand why? Do you have any idea? Thanks.
u can show us a file in question?
idk about @kyalpani, but I'm guessing my issue is related to #198. I'm hoping that the workaround suggested at the end of that issue (importing/exporting with RubyXL, repair with Excel, then use that repaired file as the new base file) will work for our use case 🤞
@weshatheleopard Thanks for maintaining a gem that can do both reading + writing for xlsx 😄
i think u have a path trouble.. try again with path="/tmp" (dont forget to upload file in there)