- 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?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lelia Rosenkrans
am 3 Dez. 2018
Bearbeitet: Lelia Rosenkrans
am 4 Dez. 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 Kommentare
Akzeptierte Antwort
Gareth
am 3 Dez. 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!