Clear Filters
Clear Filters

Search for excel spreadsheet with name or symbol

1 view (last 30 days)
I am working with Guide and looking for the code that can help me search particular excel spreadsheet. suppose there are 7 sheets with names.. Circle..Parabola..Triangle..~Data1..~Data2..Ellipse..~Data3
Now what i want is that..code should search for only spreadsheet starting with symbol '~' (tilde). so I could load data only from Spreadsheets ~Data1 ~Data2 ~Data3 and so on and also numbering of these sheets is random since am having 50 excel files with ~Data1 to ~Data15 spreadsheets. hence xlsread(..,sheet) this does not work. Glad to know if its possible.

Accepted Answer

Jan
Jan on 24 Oct 2017
The function xlsfinfo gives you a list of the sheet names:
[status, sheets] = xlsfinfo(filename);
Then find the sheet names starting with a ~:
sheetIndex = find(strncmp(sheets, '~', 1));
Now you can load this sheets:
for iSheet = sheetIndex % Perhaps sheetIndex(:).'
Data = xlsread(FileName, iSheet);
...
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!