Reading a 97-2003 xls file

How can I read a 97-2003 xls file into matlab. It gives me the error "not in Microsoft Excel Format"
If I resave the file as a newer verson I can read that but I have thousands of files I need to read and I can't go through manually changing each one.
Thank you.

7 commentaires

dpb
dpb le 12 Juil 2019
How are you trying to read the file? I've never head an issue reading .xls files with xlsread
Show your code and attach a file you're having issues with.
Oh, maybe which release of ML are using and OS release?
C
C le 15 Juil 2019
Thank you for the help!
I'm using xlsread but I've also used other commands to no avail. I'm using Matlab R2019a and Microsoft Office Professional Plus 2016.
path(path,'Desktop');
data1 = xlsread('Data');
The data resembles the attached but in the 1997-2003 verson, I can't figure out how to save a new file as this version.
dpb
dpb le 15 Juil 2019
Well, there's nothing wrong reading the attached file, but if the attached file isn't the actual file you're having trouble with, it's not much of a test...need to have the same file you can't read, not a doppelganger of it...
C
C le 15 Juil 2019
Sorry I can't share that file.
Thank you for trying to help.
Rik
Rik le 15 Juil 2019
If you put it in a zip you can upload it here. Or is your problem that it contains confidential information? In that case you'll have to try to make a file that can reproduce the problem.
Ayushman Tripathi
Ayushman Tripathi le 12 Août 2020
Modifié(e) : Ayushman Tripathi le 12 Août 2020
I was facing the same issue("not in Microsoft Excel Format") as you were while reading .xls file (1997-2003 Excel)
I came across the following link which helped resolve the issue .
In short, you can use the dlmread OR readmatrix command on MATLAB. It worked for me.
Rik
Rik le 12 Août 2020
Judging by the description there I wouldn't say it is actually an Excel file, so the error is correct. A tab delimited file is not an xls.

Connectez-vous pour commenter.

Réponses (2)

Rik
Rik le 15 Juil 2019

1 vote

Sometimes it helps to provide the full file name including the extension. That way Matlab doesn't have to determine the file type on its own.

1 commentaire

dpb
dpb le 15 Juil 2019
+1 I missed that detail and would definitely never pass an unqualified name w/o extension to xlsread. In fact, I'd expect it to fail with "file not found" and think opening a file that could possibly be different than the one passed by name verging on the edge of being a bug.

Connectez-vous pour commenter.

Sohel Rana
Sohel Rana le 9 Déc 2021

0 votes

You could use file extension.
Use xlsread ('filename.xls') instead of xlsread ('filename.xlsx') for 97-2003 xls file.
It worked for me.

Tags

Question posée :

C
C
le 12 Juil 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by