Problems reading xls files.

조회 수: 12 (최근 30일)
Claudio Iturra
Claudio Iturra 2023년 2월 2일
댓글: William Rose 2023년 2월 3일
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.

채택된 답변

William Rose
William Rose 2023년 2월 2일
편집: William Rose 2023년 2월 2일
[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
William Rose
William Rose 2023년 2월 2일
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
William Rose 2023년 2월 3일
@Claudio Iturra, I like your greeting 🙂. I guess you like G.M.V. So do I.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by