Error when using readtable!
9 views (last 30 days)
Show older comments
Error using readtable (line 197)
Unable to open file '/Users/debbieoomen/Desktop/Data Files/ActiGraphTemplateDiary.xlsx' as a workbook. Check that
the file exists, read access is available, and the file is a valid spreadsheet file.
Error in ReadDiary (line 8)
diaryfile = readtable(DiaryFile)
This code worked yesterday. However, I have changed one or two things in the sheet on my MacBook (which shouldn't be an issue). Now I keep on getting this error.
[DiaryFile,DiaryFolder] = uigetfile({'*.xls;*.csv;*.txt;*.xlsx'});
if isequal(DiaryFile,0);
ErrorDiaryfile = msgbox('No diary file selected', 'Error','error');
return
else
addpath(DiaryFolder)
diaryfile = readtable(DiaryFile)
end
I have tried turning off my mac, restarting matlab and closing excel but nothing works. Not all excel files get this error but I have attached the one that does.
1 Comment
Matthew Esch
on 4 May 2018
When I went to open the "ActiGraphTemplateDiary.xls" file you included, I got a warning that the file extension did not match the file format (On Windows). I re-saved the file as "ActiGraphTemplateDiary.xlsx".
On MAC, I ran into the same error you did executing the provided code the ".xls" file, but it worked on the ".xlsx" file without issue. Try resaving the file to the more modern ".xlsx" extension and see if it resolves the issue.
Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!