[Top][All Lists]

[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 13:36:31 -0700 (PDT)

jmb-2 wrote
> On 10/21/2014 01:16 PM, Philip Nienhuis wrote:
>> jmb-2 wrote
>>> I am trying to read an MS-Excel spreadsheet (which unfortunately is
>>> proprietary info) that results in the following error message:
> <snip>
>>> However, I can provide one clue.  If I open the same spreadsheet using
>>> LibreOffice calc Version 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!
> <snip>
>>> 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:
>> Sent from the Octave - General mailing list archive at
>> _______________________________________________
>> Help-octave mailing list

> Help-octave@

> Hello again Phillip,
> What you wrote is all very new to me, but I am trying to learn.  Here is
> what I found:
> octave_config_info ("features").JAVA
> ans =  1
> chk_spreadsheet_support ('', 3,'/usr/bin/libreoffice/program')     OR
> chk_spreadsheet_support ('', 3,'/usr/bin/libreoffice')                   
> OR
> chk_spreadsheet_support ('', 3,'/usr/bin')
> <snip>

The second invocation,

chk_spreadsheet_support ('', 3,'/usr/bin/libreoffice')

looks like it should work. Are you sure /usr/bin/libreoffice  exists and
contains a subdir 'program'?

FYI, on the Linux system I'm typing this on (Mageia-2), the javaclasspath
setup looks like:

>> chk_spreadsheet_support ('', 3, '/opt/libreoffice4.0')

.........<other interface java class libs info snipped>...............

UNO/Java (.ods, .xls, .xlsx, .sxc) <>:
  program....jar missing
  unoil....jar missing
  jurt....jar missing
  juh....jar missing
  unoloader....jar missing
  ridl....jar missing
  => One or more UNO classes (.jar) missing in javaclasspath

Trying to add missing program subdir & UNO java class libs to
  Found /opt/libreoffice4.0/program, adding it to javaclasspath ... OK
  Found unoil.jar, adding it to javaclasspath ... OK
  Found jurt.jar, adding it to javaclasspath ... OK
  Found juh.jar, adding it to javaclasspath ... OK
  Found unoloader.jar, adding it to javaclasspath ... OK
  Found ridl.jar, adding it to javaclasspath ... OK
UNO interface supported now.

Some class libs lacking yet...

ans =  128
>> javaclasspath

      - empty -



so finally the .jar files and the subdir "program" mentioned under  DYNAMIC
JAVA PATH  should be present in the javaclasspath.

BTW 1, once you wrote the .csv file, you can also try to read it with
csv2cell() (also in the io package), but you cannot specify a cell range
with it. Type "help csv2cell" to see how it is supposed to work. It is more
versatile than csvread as it can also read mixed text/numeric data.

BTW 2 Again, an .xlsx file showing the bug would be appreciated. 

BTW 3 Again, try the patched file as shown in bug #43331 (see bug tracker),
I think it should work. Looking at the error and __OCT_xlsx2oct__.m in the
io package repo for io-2.2.4 at line 237, I think that the very bug you hit
has already been fixed. (It had to do with wonky preparations for lookups in
sharedStrings.xml in the .xlsx archive.)

BTW 4 From after a few minutes from now (bed time) until next Saturday night
I have little or no spare time left so I hope you can do with these hints.


View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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