Excel (.csv) error: "Excel Worksheet could not be activated.""

8 views (last 30 days)
I am trying to read a column from a csv file.
filename = 'sample.csv';
Longitude = xlsread(filename,'D:D');
when I execute these lines, I get an error that says "Excel Worksheet could not be activated". This error does not accur when I reduce the number of rows in the sheet to 100 (originally it has ~400,000 rows). Does this problem occur because of the large number of rows? Is there a way around it?
  1 Comment
Easwar Kumar Yarrabikki
Easwar Kumar Yarrabikki on 14 Mar 2019
I faced this issue when I ignored an MS Office update for several days. Once I have updated and MS office and restarted my machine issue got resolved. Also make sure your MS Office account is also up to date.

Sign in to comment.

Answers (1)

Bob Thompson
Bob Thompson on 14 Mar 2019
A .csv file is not actually an excel format, although it can be opened with excel. I would suggest using csvread() instead, as it allows you to work directly with the proper format.
I believe it is possible to load .csv files directly with xlsread, however, you are not able to specify which sheet should be used (because .csv files cannot have multiple sheets), and specifying the range is not going to follow the same format (because .csv files do not have letter designated columns).

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!