How do I import multiple excel files from multiple folders , with different names and sizes?

조회 수: 2 (최근 30일)
Main folder has some n number of subfolders and these folders contain the excel files that I need to import to my program and store
  댓글 수: 1
Rik
Rik 2020년 1월 17일
This depends on how you want to store the data, but the dir function and a loop will probably do the trick.

댓글을 달려면 로그인하십시오.

답변 (1개)

Prajwal Venkatesh
Prajwal Venkatesh 2020년 1월 17일
clc;clear;
testfiledir = 'C:\Users\bidgu\OneDrive\Desktop\manpower';
matfiles = dir(fullfile(testfiledir, '*.xlsm'));
nfiles = length(matfiles);
datafi = cell(nfiles);
for i = 1 : nfiles
fid = fopen( fullfile(testfiledir, matfiles(i).name) );
datafi{i} = readtable(fid);
fclose(fid);
end
How do I use this code to read excel files?

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by