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


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

Submitted by:  None
Submitted on:  Mon 27 Feb 2017 03:34:01 PM UTC  
Category: Octave Forge PackageSeverity: 2 - Minor
Priority: 3 - LowItem Group: None
Status: PostponedAssigned to: None
Originator Name: Owen KellyOriginator Email: -email is unavailable-
Open/Closed: OpenRelease: other
Operating System: Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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>
Project 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 File(s):

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)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 12 Aug 2017 07:08:48 PM UTCjweSummary[OF] request for .xlsm & .xlsb support in io package=>[octave forge] (io) request for .xlsm & .xlsb support
    Mon 27 Feb 2017 07:48:59 PM UTCphilipnienhuisSeverity3 - Normal=>2 - Minor
      Priority5 - Normal=>3 - Low
      Summaryfixes loading of .xlsm files in pkg io-2.4.5=>[OF] request for .xlsm & .xlsb support in io package
    Mon 27 Feb 2017 04:12:21 PM UTCrik5Carbon-CopyRemoved 72865=>-
    Mon 27 Feb 2017 04:12:04 PM UTCrik5CategoryLibraries=>Octave Forge Package

    Back to the top

    Powered by Savane 3.1-cleanup1