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 Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by