caxlsx / caxlsx_rails

A Rails plugin to provide templates for the axlsx gem
MIT License
744 stars 84 forks source link

Excel can't open file because some content is unreadable #41

Closed yjukaku closed 8 years ago

yjukaku commented 9 years ago

Trying to use this gem for the first time, I spent about 2 hours trying to solve the error:

Excel could not open payments.xlsx because some content is unreadable. Do you want to open and repair this workbook?

The problem was that I missed the documentation stating to use wb = xlsx_package.workbook instead of p = Axlsx::Package.new.

Can we add this to the Troubleshooting section of the README?

straydogstudio commented 9 years ago

@yjukaku I definitely will. Thanks for providing the feedback.

DaleGardner commented 9 years ago

giant_thumb

moranpro commented 8 years ago

I just encountered the same problem. @straydogstudio , is there a fix? I am using Excel for Mac 2011, Version 14.6.0 on a MacBook Pro running Yosemite. I have potentially lost many hours of work on one of two sheets in a .xlsx workbook. Any help is greatly appreciated. Thanks in advance.

straydogstudio commented 8 years ago

Assuming you have not missed using the passed in xlsx_package mentioned above, have you tried using render xlsx: 'whatever', layout: false?

Sometimes, depending on what you are trying to open it with, using shared strings is also important.

It may be worthwhile making a script that you run with Rails runner to create the file using Axlsx without axlsx_rails. That will show if it is specific to axlsx or axlsx_rails.

I will get back to you tomorrow or later tonight if I can.

moranpro commented 8 years ago

Thanks for the reply. The above is Greek to me so, no, I have not tried using the string mentioned above. Also, I do not know Rails runner.

Unfortunately, I am pretty married to Mac format now, as much as i wish I wasn't, and am not nearly as conversant on that platform as I was on Windows - at least the earlier versions.

yjukaku commented 8 years ago

@moranpro Just to be clear, are you writing software using Ruby?

moranpro commented 8 years ago

No. I had constructed a couple of interior drawings using Excel: a plan drawing on one sheet and an isometric on the other. The file will not open without being "repaired", which loses the second sheet. I have not saved the file following repair, so the original, corrupted one still exists.

straydogstudio commented 8 years ago

@moranpro Sorry but I can't help you. It looks like you have a corrupted file. If you use Time Machine to backup your files (built into OSX) then you could easily recover a previous version. If not, you should get an external drive and use it. Well worth it.

moranpro commented 8 years ago

OK. I will check. I do back up regularly, but I am not sure that there was a backup done between the time I created the second sheet and the time I attempted to reopen it. Fingers crossed.

Time Machine scares me because one never really knows whether the backups are OK. I had to change out my HD a few months ago and the Time Machine backups, which were supposed to be complete, were not even close. Fortunately, I had manually copied critical data files to another hard drive prior to replacing the internal drive.

moranpro commented 8 years ago

Nope. That file did not back up. Thanks for trying. I appreciate the help.