Find the missing rows and newly added rows in two different excels sheets
5 views (last 30 days)
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.
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.
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',...
tOld = readtable('https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1069900/SummaryOld.xlsx',...
% Newly Added data
idx = ismember(tNew, tOld, 'rows');
% Missing data
idx = ismember(tOld, tNew, 'rows');