MATLAB: How can i compile many excel (xls) files in one

excelsheet

I have 100 excel (.xls) files, everyone with 1 sheet , but i need to compile all these files in only one excel file with 100 sheets .
Can anyone help me? Please
Thank you 🙂
(sorry if my english isn't perfect)

Best Answer

Luis
Depends on what version of Excel you have. With Excel 2003 and earlier you are limited to 32 worksheets. It's more for later versions but I'm not sure of the limit. Anyway to do this quickly you need to use ActiveX programming. You open Excel once, open an output workbook once, and then open each input workbook and transfer the data to a new worksheet. Then save the output workbook and Quit Excel. I've attached a demo that you can easily modify.
If that's way over your head and you don't want to learn it, then you can call xlsread and xlswrite a hundred times, but it will take forever.
See the FAQ for how to loop over the sequence of file names: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F