Problems reading xls files.
12 views (last 30 days)
Show older comments
Claudio Iturra
on 2 Feb 2023
Commented: William Rose
on 3 Feb 2023
Goooooooooooooooood Moooooooorning! Sudently I'm having problems trying to read xls files using xlsread and readtable (file attached), I wil apreciate any help with this problems.. Thanks
[~, ~, raw] = xlsread('200501.xls')
Error using xlsread
Unable to read XLS file /Users/xxx/Desktop/CS/200501.xls. File is not in recognized format.
>> t = readtable('200501.xls')
Error using readtable
Unable to open file '/Users/xxx/Desktop/CS/200501.xls' as a workbook. Check that the file exists, read
access is available, and the file is a valid spreadsheet file.
0 Comments
Accepted Answer
William Rose
on 2 Feb 2023
Edited: William Rose
on 2 Feb 2023
[edited: crrected spelling mistakes]
When I downloaded the file and tried to open it with Excel on my Windoes machine, I received a warning message saying that the file is not in the expected format. I continued anyway. Excel was able to open the file and display the contents. I see that the file has 5 columns of data, one row of headers, and many rows of data (one month of hourly weather data).
The error happens because the file is not in Excel format, even though it has a .xls extension. If you open the file with a text editor, such as Notepad, you see that it is in html (web page) format. Therefore I saved the file in Excel as a .xlsx file. See attached. Try to open this.
When I read the file with
data=xlsread('200501a.xlsx');
I see that the middle three columns (hour, direction, speed) have been successfully imported. The first and last columns were not imported.
When I read the file with
data=readtable('200501a.xlsx');
I get all five columns successfully.
xlsread() is no longer recommended. Use readtable() instead.
3 Comments
William Rose
on 2 Feb 2023
Yes, that is my recommendation: use libreoffice to save each file as .xlsx. I do not have libreoffice, and I have not used libreoffice, but I assume that your plan will work. Good luck!
William Rose
on 3 Feb 2023
@Claudio Iturra, I like your greeting 🙂. I guess you like G.M.V. So do I.
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!