Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Accessing Non-Excel Libre Spreadsheet from MATLAB

64 views
Skip to first unread message

Eric Diaz

unread,
Mar 21, 2012, 1:34:31 AM3/21/12
to
I recently started using LibreOffice for my Office document needs, as it is completely free and nearly 100% compatible with MS Office documents.

However, the other day I was using a MATLAB program that required access to an Excel spreadsheet. I encountered an error during this process and I am not sure why.

I didn't copy the error down, but I remember it saying something about an Excel server. Well, I don't have Excel because I don't have MS Office. So, is that why MATLAB had trouble with accessing the contents of the spreadsheet? I don't really understand this COM server stuff at all? Is there a COM server method for accessing open-source office spreadsheets?

Eric Diaz

unread,
Mar 25, 2012, 4:48:10 PM3/25/12
to
Bump...

Steven_Lord

unread,
Mar 26, 2012, 9:43:11 AM3/26/12
to


"Eric Diaz" <eric...@gmail.com> wrote in message
news:jkbp97$bmn$1...@newscl01ah.mathworks.com...
> I recently started using LibreOffice for my Office document needs, as it
> is completely free and nearly 100% compatible with MS Office documents.
>
> However, the other day I was using a MATLAB program that required access
> to an Excel spreadsheet. I encountered an error during this process and I
> am not sure why.
>
> I didn't copy the error down, but I remember it saying something about an
> Excel server. Well, I don't have Excel because I don't have MS Office.
> So, is that why MATLAB had trouble with accessing the contents of the
> spreadsheet?

When running XLSREAD on a machine that is not a Windows machine with
Microsoft Excel installed, XLSREAD will operate in "basic mode":

http://www.mathworks.com/help/techdoc/ref/xlsread.html

"[num,txt,raw] = xlsread(filename,sheet,range,'basic') reads data from the
spreadsheet in basic mode, the default on systems without Excel for
Windows."

Basic mode has some limitations, as described in the Input Arguments section
of that documentation, and it appears you were trying to do something that
exceeded the capabilities of basic mode.

> I don't really understand this COM server stuff at all? Is there a COM
> server method for accessing open-source office spreadsheets?

If the program offers a COM interface, yes, but a quick glance at the
LibreOffice website didn't indicate that it had such an interface.

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Eric Diaz

unread,
Mar 27, 2012, 6:53:14 PM3/27/12
to
> When running XLSREAD on a machine that is not a Windows machine with
> Microsoft Excel installed, XLSREAD will operate in "basic mode":
>
> http://www.mathworks.com/help/techdoc/ref/xlsread.html
>
> "[num,txt,raw] = xlsread(filename,sheet,range,'basic') reads data from the
> spreadsheet in basic mode, the default on systems without Excel for
> Windows."
>
> Basic mode has some limitations, as described in the Input Arguments section
> of that documentation, and it appears you were trying to do something that
> exceeded the capabilities of basic mode.
>

Right...I remember it saying something about "basic mode" too, but it still gave the errors.

> > I don't really understand this COM server stuff at all? Is there a COM
> > server method for accessing open-source office spreadsheets?
>
> If the program offers a COM interface, yes, but a quick glance at the
> LibreOffice website didn't indicate that it had such an interface.

OK, thanks. I guess that is about as close to an answer as I can get, since you work at TMW. Do you know whether there is any way to resolve this problem other than bowing down to the almighty Microsoft Office? I would definitely like to see support for an open office suite, like Libre.

TideMan

unread,
Mar 27, 2012, 7:52:37 PM3/27/12
to Eric Diaz
A work around would be to save the spreadsheet as a .csv file, then getting the data into Matlab is a breeze (and faster than xlsread as well).

Steven_Lord

unread,
Mar 28, 2012, 10:10:03 AM3/28/12
to


"Eric Diaz" <eric...@gmail.com> wrote in message
news:jktgcq$m80$1...@newscl01ah.mathworks.com...
>> When running XLSREAD on a machine that is not a Windows machine with
>> Microsoft Excel installed, XLSREAD will operate in "basic mode":
>>
>> http://www.mathworks.com/help/techdoc/ref/xlsread.html
>>
>> "[num,txt,raw] = xlsread(filename,sheet,range,'basic') reads data from
>> the spreadsheet in basic mode, the default on systems without Excel for
>> Windows."
>>
>> Basic mode has some limitations, as described in the Input Arguments
>> section of that documentation, and it appears you were trying to do
>> something that exceeded the capabilities of basic mode.
>>
>
> Right...I remember it saying something about "basic mode" too, but it
> still gave the errors.

If you show the group a small section of your code and explain specifically
what you're trying to do, perhaps someone will have some suggestions for how
to do what you want in such a way that you don't run into the basic mode
limitations.

>> > I don't really understand this COM server stuff at all? Is there a COM
>> > server method for accessing open-source office spreadsheets?
>>
>> If the program offers a COM interface, yes, but a quick glance at the
>> LibreOffice website didn't indicate that it had such an interface.
>
> OK, thanks. I guess that is about as close to an answer as I can get,
> since you work at TMW. Do you know whether there is any way to resolve
> this problem other than bowing down to the almighty Microsoft Office? I
> would definitely like to see support for an open office suite, like Libre.

Having a function to read in LibreOffice spreadsheets sounds like a
reasonable enhancement request to make to Technical Support. Let them know
the type of functionality you'd like to see included in such a function, so
they can capture it in the enhancement database and give the developers
guidance when or if they decide to implement this feature. [Enhancement
requests like this tend to carry more weight from users.]

Another approach you could take would be to ask the LibreOffice developers
for an enhancement, a COM interface to their software on Windows. If they
implemented such an interface, you could use the COM interface functionality
in MATLAB to interact with LibreOffice in the same way that the COM
interface functionality allows users to interact with the COM interface
provided by Microsoft Excel.

http://www.mathworks.com/help/techdoc/matlab_external/brd4at8.html

http://www.mathworks.com/help/techdoc/matlab_external/bqdwu3j.html#bqd_o32

mklcst mklcst

unread,
Jun 4, 2012, 4:46:06 AM6/4/12
to
TideMan <mul...@gmail.com> wrote in message <14349772.98.1332892357752.JavaMail.geo-discussion-forums@ynaz5>...
I think it's time for Matlab to fully support libreoffice (or OpenOffice or whatelse).
A part for the office license, it would amazing also for the unix platform linux and Mac.

Steven_Lord

unread,
Jun 4, 2012, 9:37:39 AM6/4/12
to


"mklcst mklcst" <mk...@gmail.com> wrote in message
news:jqhske$lpg$1...@newscl01ah.mathworks.com...
Then please contact Technical Support and ask them to enter this request
into the enhancement database (or update the existing entry with one more
"vote".)

D

unread,
Oct 23, 2013, 7:28:09 PM10/23/13
to
TideMan <mul...@gmail.com>
> A work around would be to save the spreadsheet as a .csv file, then getting the data into Matlab is a breeze (and faster than xlsread as well).

I ran into OP's problem too, and I found that csvread, which you seem to be suggesting as a work around, only reads in csv files whose data is numbers(double); no other data types are accepted. Having a text heading cell such as 'values' will throw an error and the script will stop.
I'm another vote for MATLAB being able to read/write Libre files. I will find and contribute to existing requests at MATLAB and at Libre.

TideMan

unread,
Oct 23, 2013, 7:56:52 PM10/23/13
to
Why on earth would you want to use csvread for such a purpose?
The help clearly says:
" The file can only contain
numeric values."
Use textscan.
It is so much more flexible.
0 new messages