Compare two excel files and generate a new one that contains all columns
13 views (last 30 days)
Show older comments
Hello everyone,
I have two excel files. They are filled out with numbers and text. The first file has 6 columns, say (a, b, c, d, e, f), while the second file has one column called "g" in addition to some similar columns like (a, b, c) , i.e, second files has 4 columns (a, b, c, g).
I would like to go through each row of the second file, figure out it is equivalent with which row of the first file (which row in the first file has the same values in columns (a, b, c)), and then add the value in column "g" to the first file and generate a new excel with 7 columns (a,b,c,d,e,f,g).
Any input would be greatly appreciated! Thanks!
2 Comments
Accepted Answer
Cris LaPierre
on 7 May 2020
Edited: Cris LaPierre
on 7 May 2020
Sounds like you want to join tables using a,b, and c as your key variables. I would use readtable to import the two spreadsheets into MATLAB (or the import tool) as tables, and then use the interactive Join Tables task in a live script to generate the correct output.
More Answers (0)
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!