How can I use 'textscan' to read data from Sheet2 of an Excel file?

13 views (last 30 days)
As said in question, want to know if textscan can be used to scan data from Sheet2 of an Excel file?
Thanks for any help.
  8 Comments
Jan
Jan on 7 Jan 2019
@Tahir Ameen: CSV files do not have sheets. A CSV file is a text file and there is no way to define something like a sheet in it. Then neither textscan cannot have the power to select a sheet. Sheets are properties of binary XLS and XLSX files. There is no way to use a tool written to import text files of a certain format to import binary files on another format.
Summary: textscan imports text files only and text files do not have sheets. If you need to import sheets, use readtable or xlsread.
Now you reveal, that you are struggeling with dates. Of course this can be solved directly without the need of the time-consuming indirection over CSV files. Please post the current code and an example file. Then it is possible to suggest a solution.
per isakson
per isakson on 7 Jan 2019
Edited: per isakson on 7 Jan 2019
Caveat: Personally I try to avoid Excel. What looks like datetime in Excel may be a character string or "datenum of Excel" presented as datetime. xlsread reads the first as a character string and the latter as a "strange number".

Sign in to comment.

Accepted Answer

per isakson
per isakson on 7 Jan 2019
Try
readtable( _______, 'DatetimeType', 'exceldatenum' );
See the documentation.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!