Find the missing rows and newly added rows in two different excels sheets
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Akira Agata
2022 年 7 月 19 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!