Search code examples
octave

Why can octave xlsread not read my xlsx file?


I just installed the io package of octave using

pkg install ~/octave/io-2.6.4.tar.gz

But when I now call xlsread from the octave prompt,

[numarr,txtarr,rawarr,limits] = xlsread('file_example_XLS_10.xlsx')

using the first example file from

https://file-examples.com/index.php/sample-documents-download/sample-xls-download/

(after reformatting with Libre Office Calc to .xlsx) I get the following error:

error: cellfun: invalid function NAME: col2num 
error: called from 
    __OCT_xlsx2oct__ at line 210 column 12
    xls2oct at line 219 column 32 
    xlsread at line 384 column 32

What am I doing wrong?

Edit 3.1.2025:

I followed the suggestion to install fileio. Running

pkg describe fileio -verbose

produces

Package name:
        fileio
Version:
        1.2.2
Short description:
        The package contains reading and writing functions 
        and conveninece  wrappers for common file types 
        holding structured data. This version handles  
        JSON and XML files.  The XML-related function are 
        based on the work of Jarek Tuszynski at SAIC.
Depends on:
        octave >= 7.2.0
Depended on by:

Status:
        Loaded
---
Provides:
JSON
        jsonread
        jsonwrite
XML
        readxml
        writexml

Thus the package does not seem to support facitities for reading xlsx files.


Solution

  • Following the hints of Cris Luengo, the problem was solved by upgrading octave to the latest stable version 9.3, then reinstalling the io package and loading it into my Octave session.