bugGNU Octave - Bugs: bug #50412, [octave forge] (io) request for...


bug #50412: [octave forge] (io) request for .xlsm & .xlsb support

Submitter:  None
Submitted:  Mon 27 Feb 2017 03:34:01 PM UTC
Category:  Octave Package Severity:  2 - Minor
Priority:  3 - Low Item Group:  None
Status:  Postponed Assigned to:  None
Originator Name:  Owen Kelly Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 27 Feb 2017 07:48:59 PM UTC, comment #1: 

Issue 1 has already been fixed a while ago:
(the proper fix was a bit more involved than simply setting r_extnd to 0)

FYI: the io package has received several bug fixes since 2.4.5, see
Once I have time (hopefully somewhere soon) I'll make a new release (2.4.6 or a 2.6.0, depending on more code changes I only have in my local repos).

Issue 2:
I've looked into this several years ago. Result: .xlsm is intentionally not supported.
Reading from .xlsm may be OK, but writing to .xlsm is a different thing. There's simply too much internal bookkeeping involved.  The more so for .xlsb.
FYI to safely support those file types quite a few more changes are required in various places scattered over the code than you noted.

If you can provide a number of reasonably complicated .xlsm and .xlsb files for testing I'm definitely willing to try to implement it (at least reading) but I have (1) little time and (2) other priorities ATM so it may take quite a while.

Note that the COM interface (=Excel itself behind the scenes) can obviously process these file types OOTB.  But chances are that once the spreadsheet I/O moves to core Octave (the intention is still there I believe) the COM interface will be dropped.
I'm unsure about .xlsb and .xlsm support with the only other interfaces that support OOXML (POI = Apache POI, UNO = LibreOffice).  As far as OCT goes I already found that .xlsm support adds more complexity for safely writing to file.
OXS (OpenXLS) does feature OOXML I/O but I found it too buggy and although the code is there I've disabled it.

Title adapted
Setting Priority => low
Release => other (not core Octave)
Severity => Minor
Status => Postponed

Philip Nienhuis <philipnienhuis>
Group Member
Mon 27 Feb 2017 03:34:01 PM UTC, original submission:  

Issue 1:

There is an execution path of packages\io-2.4.5\xlswrite.m that throws an error with variable r_extnd not defined.

Solution 1:
   Add line 129:
     r_extnd = 0;

Issue 2:

The regex to recognize file extension (line 186) does not capture '.xlsm'. Note, in the solution, the order of patterns is important; .xls should be last in the group of .xls? patterns.

Solution 2:

In file packages\io-2.4.5\xlsopen.m
   Change line 186 to
     [sfxpos, ~, ~, ext] = regexpi (filename, '(\.xlsm|\.xlsb|\.xlsx|\.xls|\.gnumeric|\.ods|\.csv)');
     [sfxpos, ~, ~, ext] = regexpi (filename, '(\.xlsx?|\.gnumeric|\.ods|\.csv)');

Issue 3:

Files of type .xlsm are not recognized by getnmranges.m.
After the name is recognized, the xlsm files appear to load successfully, though I have not reviewed closely.

Solution 3:

In file packages\io-2.4.5\private\__OCT_getnmranges__.m
   Change line 29 to
       case {".xlsx", ".xlsm"}
       case ".xlsx"



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-12 jwe Summary[OF] request for .xlsm &amp; .xlsb support in io package [octave forge] (io) request for .xlsm & .xlsb support
    2017-02-27 philipnienhuis Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        StatusNone Postponed
        Release4.2.1 other
        Summaryfixes loading of .xlsm files in pkg io-2.4.5 [OF] request for .xlsm & .xlsb support in io package
    2017-02-27 rik5 Carbon-CopyRemoved 72865 -
    2017-02-27 rik5 CategoryLibraries Octave Package

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code