read multiple excel files with different file names ?

I want to multiple excel files with different file names like R1 (1).xlsx, R1 (2).xlsx, R1 (3).xlsx........... till R1 (30).xlsx and want to extract data having same sheet name and column number in each excel files. lets say Sheet name is "ABC" in each excel file and want to extract column T and U from this sheet from all the sheets.

回答 (1 件)

KSSV
KSSV 2020 年 8 月 27 日

0 投票

xlFiles = dir("*.xlsx") ;
N = length(xlFiles) ;
for i = 1:N
thisFile = xlFiles(i).name ;
T = readtable(thisFile) ;
% do what you want
end

4 件のコメント

mukesh meharda
mukesh meharda 2020 年 8 月 27 日
How to read Sheet name having "ABC" and extract data from column T:U from each excel file ?
KSSV
KSSV 2020 年 8 月 27 日
You can use xlsread.Read the action.
mukesh meharda
mukesh meharda 2020 年 8 月 27 日
then I have to write this 30 times for each excel files
KSSV
KSSV 2020 年 8 月 27 日
Put in a loop....idea is already given in the answer.

サインインしてコメントする。

質問済み:

2020 年 8 月 27 日

コメント済み:

2020 年 8 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by