MATLAB: Importing and appending a complete folder of excel files

data import

Hi,
I have a folder in which I have around 225 excel files: MA1.xlsx,MA2.xlsx,….MA225.xlsx. all of them have the same column numbers. Is their a way to import all these to Matlab in one shot and append them to a table?
In other words can if all these excel files are under the folder C:\Users\w\Documents\Matla\Data , can I import the entire folder to matlab and append the files that are in it to create a large table?
Your help is greatly appreciated, otherwise I need to create the names and a loop I believe?

Best Answer

It depends on what "in one shot" means. It is trivial to create a loop to import one file after the other, see FAQ: Access a sequence of files .
Base = 'C:\Users\w\Documents\Matla\Data';
List = dir(fullfile(Base, '*.xlsx'));
Result = cell(1, numel(List));
for k = 1:numel(List)
File = fullfile(Base, List(k).name);
Result = readtable(File); % Or specify what you want to import
end