help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error reading .xlsx file using io


From: Philip Nienhuis
Subject: Re: Error reading .xlsx file using io
Date: Tue, 21 Oct 2014 10:16:43 -0700 (PDT)

jmb-2 wrote
> I am trying to read an MS-Excel spreadsheet (which unfortunately is
> proprietary info) that results in the following error message:
> 
> octave:1> pkg load io;
>       octave:2> A = xlsread ("File1.xlsx", 'First_Table', 'A5:Y67');
>       Detected XLS interfaces: error: cell2mat: C is not a cell array
>       error: called from:
>       error:   /opt/octave3.8/share/octave/3.8.1/m/general/cell2mat.m at line
> 36, column 5
>       error:   /home/.../octave/io-2.2.4/private/__OCT_xlsx2oct__.m at line
> 237, column 14
>       error:   /home/.../octave/io-2.2.4/xls2oct.m at line 210, column 27
>       error:   /home/.../octave/io-2.2.4/xlsread.m at line 214, column 25
> 
> The "File1.xlsx" spreadsheet was created using MS-Excel 2010, by
> somebody else.
> 
> The pertinent version info:
> 
>       octave:2> version
>       ans = 3.8.1
>       octave:3> pkg list
>       Package Name    | Version | Installation directory
>       ----------------+---------+-----------------------
>                  io *|   2.2.4 | /home/.../octave/io-2.2.4
> 
>       lsb_release -a
>       Description:    Ubuntu 12.04.5 LTS
> 
>       uname -a
>       Linux ... 3.5.0-55-generic #82~precise1-Ubuntu SMP Tue Sep 16 06:26:39
> UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
> 
> However, I can provide one clue.  If I open the same spreadsheet using
> LibreOffice calc Version 3.5.7.2 Build ID 350m1(Build:2) and save it as
> a different file named "File2.xlsx"; using the "Microsoft Excel
> 2007/2010 XML (.xlsx)" format, then:
>       octave:3> A = xlsread ("File2.xlsx", 'First_Table', 'A5:Y67');
> This works just fine!
> 
> Has anybody encountered such a problem or have clues as to what is
> wrong.  I tried somewhat to debug it but I got lost in how line 237 of
> __OCT_xlsx2oct__.m & line 36 of cell2mat.m work... :)
> 
> Apparently, the decoding of the .../xl/worksheet/Sheet1.xml file is
> getting clobbered.
> 
> My workaround has been to export the MS-Excel file to a .csv file and
> use textread, but I was trying to read the .xlsx file directly.
> 
> Thanks for any help/fix that may be advised.

Without an example file showing the bug there's little to say about the
cause.

However, in the last weeks several bugs have been fixed with the OCT
interface (the spreadsheet I/O interface that works w/o Java). See esp. bug
#43331 on the bug tracker; you can d/ld the patched file from the repo and
try again.

The fixes will be part of io-2.2.5 to be released within one or two weeks, I
hope.

As you wrote, Excel itself is very picky. 
If your Octave version has been built with Java support (if 
octave_config_info ("features").JAVA
returns  1)
you can also try the UNO interface (that'll invoke LibreOffice rather than
the OCT interface code).
The function chk_spreadsheet_support can help to setup the javaclasspath:
chk_spreadsheet_support ('', 3,
'/full/path/to/LibreOffice/installation/directory')
(note consecutive single quotes for 1st argument, argument 2 ("3") regulates
the verbosity, 3 = max).

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Error-reading-xlsx-file-using-io-tp4667058p4667063.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]