[Top][All Lists]

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

Re: Error reading .xlsx file using io

From: jmb
Subject: Re: Error reading .xlsx file using io
Date: Tue, 21 Oct 2014 14:40:40 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2

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:

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 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

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

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,
(note consecutive single quotes for 1st argument, argument 2 ("3") regulates
the verbosity, 3 = max).

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

Help-octave mailing list

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')

(OCT interface... OK, included in io package)

1. Checking Octave's Java support... OK.
2. Checking Java dependencies...
  Checking Java JRE presence.... OK, found one.
  Java seems to work OK.
  Java (version 1.6.0_33) seems OK.
  Maximum JVM memory:  1755 MiB; sufficient.
Checking javaclasspath for .jar class libraries needed for spreadsheet I/O...:

Basic POI (.xls) <poi-3> <poi-ooxml>:
  apache-poi./poi-3....jar missing
  apache-poi-ooxml./poi-ooxml-3....jar missing
  => Not all classes (.jar) required for POI in classpath

POI OOXML (.xlsx) <xbean/xmlbean> <poi-ooxml-schemas> <dom4j>:
  xbean/xmlbean....jar missing
  apache-poi-ooxml-schemas/poi-ooxml-schemas....jar missing
  dom4j....jar missing
  => Some classes for POI OOXML support missing

JExcelAPI (.xls (incl. BIFF5 read)) <jxl>:
  jxl....jar missing
  => Not all classes (.jar) required for JXL in classpath

OpenXLS (.xls - BIFF8 & .xlsx - OOXML) <OpenXLS>:
  OpenXLS....jar missing
  gwt-servlet-deps....jar missing

ODF Toolkit (.ods) <odfdom> <xercesImpl>:
  odfdom....jar missing
  xercesImpl....jar missing
  => Not all required classes (.jar) in classpath for OTK

jOpenDocument (.ods + experimental .sxc readonly) <jOpendocument>:
  jOpenDocument....jar missing
  => Not all required classes (.jar) in classpath for JOD

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 javaclasspath...
Suggested install directory: /usr/bin not found!
ans = 0

I tried:
A = xlsread ("File1.xlsx", 'First_Table', 'A5:Y67', {'UNO'});
but get: UNO is not supported.  I am clearly missing something - my knowledge of the io module for sure.  What do I need to do to enable/install the various jar's?  Could you point me to some URL that teaches me?

Thanks in advance... Regards, JMB

reply via email to

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