Find the missing rows and newly added rows in two different excels sheets
3 views (last 30 days)
Show older comments
Santosh Biradar
on 19 Jul 2022
Edited: Santosh Biradar
on 21 Jul 2022
Hello
I am comparing and finding out the missing rows and newly added rows data from two different excels sheets.
I have attached 3 files.
SummaryNew.xlsx and SummaryOld.xlsx are having data. Compare those 2 excel files.
- SummaryResult.xlsx In a result, I am expecting 2 sheets. MissingData and NewlyAddedData.
Thank you!!
I tried using
diff_rows = find(all(cellfun(@isequal, SummaryOld', SummaryNew')) == 0);
similar_rows = find(all(cellfun(@isequal, SummaryOld', SummaryNew')) == 1);
bt it is just comparing one excel whole with other.
0 Comments
Accepted Answer
Akira Agata
on 19 Jul 2022
How about the following?
% Load the Excel files
tNew = readtable('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1069895/SummaryNew.xlsx',...
'VariableNamingRule','preserve');
tOld = readtable('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1069900/SummaryOld.xlsx',...
'VariableNamingRule','preserve');
% Newly Added data
idx = ismember(tNew, tOld, 'rows');
tNew(~idx,:)
% Missing data
idx = ismember(tOld, tNew, 'rows');
tOld(~idx,:)
4 Comments
More Answers (0)
See Also
Categories
Find more on Spreadsheets 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!