adding multiples xlsx sheets in a workbook

10 次查看(过去 30 天)
hello!
After processing my data with Matlab, I have 5 several .xlsx files, each one with 1 sheet.
Now, I want a xlsx workbook with these 5 sheets, conserving the same sheet name for each one.
I've tried with the code attached below, but I can't keep the sheet names of each single file into the excel worbook.
Can you help me?
Thank you very much!
Attached you can find the .xlsx files.
outfile = 'C:\Users\alberto\MATLAB_TRABAJO\prueba matlab\test.xlsx';
for k=1:length(archives)
writetable(Table,outfile,'Sheet',k,'Range','A1','WriteVariableNames',true);
end
%d=dir('*.xlsx');
%for i=1:numel(d)
%xlsheets(extractBetween(d(i).name,'16_','.'),d(i).name);
%end
  2 个评论
dpb
dpb 2021-4-6
xlsheets(extractBetween(d(i).name,'16_','.'),d(i).name);
what is xlsheets in the above code and explain more clearly what you're trying to accomplish.
You wrote a file with sheets 1 thru 5 that have default name for each by addressing them as numeric.
Alberto Martínez
编辑:Alberto Martínez 2021-4-8
Thank you for your answer.
xlsheets is a very helpful function that I use to name the sheet. Attached you can find the link.
I have 5 .xlsx files, each one with one sheet
PM1.xlsx (sheet name: EV_PM1)
PM2.xlsx (sheet name: EV_PM2)
PM3.xlsx (sheet name: EV_PM3)
PM4.xlsx (sheet name: EV_PM4)
PM5.xlsx (sheet name: EV_PM5)
I need only 1 .xlsx file called 'test.xlsx' with the previous 5 sheets (PM1, PM2, PM3, PM4, PM5), but I can't do it.
Thank you for your attention and your help.

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by