Reading from Multiple files & Multiple sheets
Afficher commentaires plus anciens
I have 60 excel files named 1,2 ...60 and each file consists of 9 sheets(Same name). I have to read from these files and consolidate in another file. Can you please help me to do this operation by looping. see the code below. Can someone suggest an easier way to read sheet names by looping and getting sheet names from an array? Is it possible. Similarly can I get workbook names from an array?
exwb1 = ex.Workbooks.Open('C:\Advisory\1.xls');
exwb44 = ex.Workbooks.Open('C:\Advisory\Target.xls');
%-------------------Open WorkSheets in Workbooks-----------------
exSheet1=exwb1.Sheets.Item('Dip1');
exSheet2=exwb2.Sheets.Item('Dip2 EPE');
exSheet3=exwb3.Sheets.Item('Dip2 ECE');
exSheet4=exwb4.Sheets.Item('Dip2 ME');
exSheet5=exwb5.Sheets.Item('Dip2 Arch');
exSheet6=exwb6.Sheets.Item('Dip2 QS');
exSheet7=exwb7.Sheets.Item('AD EPE');
exSheet8=exwb8.Sheets.Item('AD ECE');
exSheet9=exwb9.Sheets.Item('AD ME');
%Output File
exSheet44=exwb44.Sheets.Item('Sheet1');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!