- Range is where we specify the range that you are looking for in Excel (same way you would declare this in Excel)
- Given that I don't know the VariableNames I put false, but you could extend this
- I used pwd as the path but you could run this from anywhere:)
How to copy and paste a single row in an excel file to another excel file?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lelia Rosenkrans
el 3 de Dic. de 2018
Editada: Lelia Rosenkrans
el 4 de Dic. de 2018
Hello,
I am trying to copy a single row from multiple excel files and paste them into a master document. These files are all in one folder, but do not have similar file names. The row I am looking to copy contains both numbers and letters, and is row 3 of the original excel sheet.
Here is an example of how the excel file is formated
A B C D E F ...
1 L L L L L L
2 R R R R R R
3 13 Q 14 T S 75
4 0 0 0 0 0 0
Any help is much appreciated!
0 comentarios
Respuesta aceptada
GT
el 3 de Dic. de 2018
I am using R2018b, and there are a couple of ways of solving this. I like the following:
ds = spreadsheetDatastore(pwd,'Range','A3:D3','ReadVariableNames',false)
ds.readall
Please note that:
I hope this helps:)
There are other types of Datastores which make these kind of things really simple. I believe SpreadsheetDataStore came out in R2016a.
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!