Importing Data from excel across multiple sheets and filenames.
Mostrar comentarios más antiguos
I am attempting to import multiple strings of data from excel spread sheets and was hoping that the same ranges across multiple sheets could be imported with the same command.
Was thinking it would be a for loop but was unsure how to set it up best.
A total of 8 data sets will be imported from 12 sheets. Any help is greatly appreciated or any questions. :)
3 comentarios
Azzi Abdelmalek
el 25 de Ag. de 2016
8 data sets will be imported from 12 sheets. What does that mean?
Guillaume
el 25 de Ag. de 2016
Yes, you can pass the same range to each call of xlsread, just as you can pass the same arguments to each call of a function.
It's very unclear what problem you are having.
Declan Simons
el 25 de Ag. de 2016
Editada: Declan Simons
el 25 de Ag. de 2016
Respuesta aceptada
Más respuestas (2)
Kristian Opsahl
el 12 de Sept. de 2018
1 voto
Hi,
This code worked fine to import my data. However it does not import the dates that I have in column A on every sheet. Any workaround/solution to that?
1 comentario
NAGENDRA ACHANTA
el 7 de Nov. de 2019
Use [~,~,data{k}] instead of data{k}
Carlos Riascos
el 17 de Feb. de 2023
0 votos
I would recommend something like this:
[~,sheet_name]=xlsfinfo('filename.xlsx')
for k=sheet_name
[~,~,data.(k{1})]=xlsread('filename.xlsx',k{1});
end
Note: be careful with not having spaces or unallowed symbols in the sheet_name, otherwise use the command replace.
Categorías
Más información sobre Spreadsheets en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!