Getting "OLE2 signature is invalid (Ole::Storage::FormatError)" on a .xlsx file

5,308 views
Skip to first unread message

Mike

unread,
Mar 2, 2012, 10:58:30 AM3/2/12
to rubyspr...@googlegroups.com
Hi,

I've never managed to use 'spreadsheet' to read an xlsx (Excel 2007) format spreadsheet.  I always get this error.

Can someone say if this format is supported, and if it is, how can I open it?

I've tried various options - setting the encoding to UTF-8 prior to opening; opening in binary ('rb') and not ('r').

I've also set file options to '777' in case write access is needed - even though I'm only  trying to read.  The spreadsheet has 3 sheets, but data in only one of the sheets. There's no password protection or anything "interesting" about it so far as I can tell. In fact it just contains data in cell A1 and that's it.

This is on Linux with Ruby 1.8.7 and using spreadsheet v0.6.8

Any pointers would help, thanks.

Mike.

Zeno Davatz

unread,
Mar 2, 2012, 12:00:22 PM3/2/12
to rubyspr...@googlegroups.com
Dear Mike

On Fri, Mar 2, 2012 at 4:58 PM, Mike <mflint....@gmail.com> wrote:

> I've never managed to use 'spreadsheet' to read an xlsx (Excel 2007) format
> spreadsheet.  I always get this error.

What error do you get? I guess you will need to save it as a "normal" XLS file.

> Can someone say if this format is supported, and if it is, how can I open
> it?

> I've tried various options - setting the encoding to UTF-8 prior to opening;
> opening in binary ('rb') and not ('r').

I guess the format is not supported yet.

> I've also set file options to '777' in case write access is needed - even
> though I'm only  trying to read.  The spreadsheet has 3 sheets, but data in
> only one of the sheets. There's no password protection or anything
> "interesting" about it so far as I can tell. In fact it just contains data
> in cell A1 and that's it.
>
> This is on Linux with Ruby 1.8.7 and using spreadsheet v0.6.8

Save the file with OpenOffice as a "normal" XLS file and your problems
will be gone.

Best
Zeno

Mike

unread,
Mar 5, 2012, 5:30:54 AM3/5/12
to rubyspr...@googlegroups.com
Hi Zeno,

Thanks for the response.  Unfortunately I'm not creating the spreadsheet - it's being sent to me by an external company attached to an email.

I'll have to be creative I guess :)

Mike.


On Friday, March 2, 2012 5:00:22 PM UTC, Zeno R.R. Davatz wrote:
Dear Mike

Mike

unread,
Mar 5, 2012, 6:17:30 AM3/5/12
to rubyspr...@googlegroups.com
I've changed to using roo - despite my reading of the documentation (which implies it uses 'spreadsheet') it actually has native support for .xlsx format (at least to read, which is all I want.

.xlsx is much easier to handle then .xls, being just a Zip archive holding an XML version of the spreadsheet; although I guess writing one would be more of a trial :)

Mike.

Zeno Davatz

unread,
Mar 5, 2012, 8:50:18 AM3/5/12
to rubyspr...@googlegroups.com
Dear Mike

On Mon, Mar 5, 2012 at 12:17 PM, Mike <mflint....@gmail.com> wrote:
> I've changed to using roo - despite my reading of the documentation (which
> implies it uses 'spreadsheet') it actually has native support for .xlsx
> format (at least to read, which is all I want.
>
> .xlsx is much easier to handle then .xls, being just a Zip archive holding
> an XML version of the spreadsheet; although I guess writing one would be
> more of a trial :)

Good to know. Please keep us posted.

Best
Zeno

Reply all
Reply to author
Forward
0 new messages