is that possible to extract out all the data in second sheet from each of the excel file into new excel file? mean that i have a huge excel files in a folder, i would like to extract out all the second sheet from each of the excel file into new excel file. The sheet name is not the same.
fns = dir('*.xls');
for i = 1:length(fns)
s=xlsread('fns(i).name', 2); %read second sheet for each .xls file
xlswrite('newfile.xls'); %write the second sheet to newfile.xls
end
I have problem with the code i wrote above. anyone can help?
Consider the following structure of files:
Here is an example where we read the second sheet from each XLS file in the directory
in, and write them all out as sheets to a new fileout.xlsin the current folder: