Convert multiple csv to xls files.
Ältere Kommentare anzeigen
Hi!
I have a folder containing many excel files ( more than 200) in csv format . I need to write all these files in xls format.
Can this be done in matlab . Can anyone please help.
Thanks in advance
Akzeptierte Antwort
Weitere Antworten (2)
Fabian Neira
am 1 Jun. 2018
0 Stimmen
I got the following error "File name must be a character vector" when using the code.
1 Kommentar
Walter Roberson
am 1 Jun. 2018
Please post your code.
Lotan Jackson
am 25 Aug. 2020
Hi everyone, I know this is an old question but I had to adjust things for either the newest version or being on a newest matlab version. Here's the code. I placed all the files in the folder with the script.
file = dir('*.csv');
s= size(file,1);
for i= 1:s
Data = readtable(file(i).name);
filename=file(i).name;
filename= filename(1:end-5);
writetable(Data,[filename '.xls']);
end;
Hope this helps anyone in the future. :)
1 Kommentar
Marcos dos Santos
am 16 Apr. 2021
It helped me. Thank you, Lotan!
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!