importing multiple excel workbooks with multiple sheets into a cell array.
Show older comments
Hi,
I have 11 different excel workbooks and all labeled 001 through 011. what i would like to do with them is have a cell matrix with each cell being one of the excel workbooks and each cell within Those cells being a sheet from the workbooks. I have some code where i can import only one workbook at a time but it does not split up the sheets like i would like, instead it just imports all sheets from a workbook into one large table.
clc;
clear;
close all;
fn='001.xlsx';
tBC=[];
opt=detectImportOptions(fn);
shts=sheetnames(fn);
for i=1:numel(shts)
tBC=[tBC;readtable(fn,opt,'Sheet',shts(i))];
end
I also have to manually change the name of each workbook when i want to import a new one which i would prefer be automated up until 011. Im really not the best at MATLAB but am trying to learn so any help would be appreciated.
Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!