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: Matthew D Antalek
Subject: Re: Error reading .xlsx file using io
Date: Tue, 21 Oct 2014 12:45:10 -0400

You can also try using python. I know python has a package that can open xlsx files, I think it's called openpyxl. You can then use python to convert the data into a matlab readable data file. As far as I know there are no octave packages that open xlsx files.

HTH
-Matt


On Tue, Oct 21, 2014 at 11:04 AM, Joris de Ruiter <address@hidden> wrote:
Hi JMB, 

You can save the file as csv in Excel, then load with csvread

If that doesn't work, you can try 

X = dlmread (FILENAME, "," , ...)

on the csv file, where , is your seperator (change to ; if needed)

Joris


On 21 October 2014 15:09, jmb <address@hidden> 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.

Regards, JMB

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave


_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave



reply via email to

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