Problems reading xls files.
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Claudio Iturra
el 2 de Feb. de 2023
Comentada: William Rose
el 3 de Feb. de 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 comentarios
Respuesta aceptada
William Rose
el 2 de Feb. de 2023
Editada: William Rose
el 2 de Feb. de 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 comentarios
William Rose
el 2 de Feb. de 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
el 3 de Feb. de 2023
@Claudio Iturra, I like your greeting 🙂. I guess you like G.M.V. So do I.
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!