I'm trying to find a way to delete all BUT the repeated rows in a file, I know it's possible to delete the duplicates on a file using something like this:
$worksheet = $objPHPExcel->getActiveSheet();
However I need to do pretty much the opposite, delete all the rows that doesn't have any duplicates in the file.
*Why do I need this: The duplicate rows are the intersection between M x M sets with data. It's way easier to do it directly on the file that having to considerate the M x M possible results.*
I'd greatly appreciate any guidance you might offer me.
$worksheet = $objPHPExcel->getActiveSheet();
foreach ($worksheet->getRowIterator() as $row) {
$rowIndex = $row->getRowIndex();
foreach ($worksheet->getRowIterator($rowIndex + 1) as $testRow) {
if ($testRow == $row) {
$worksheet->removeRow($rowIndex);
}
}
taken from hereHowever I need to do pretty much the opposite, delete all the rows that doesn't have any duplicates in the file.
*Why do I need this: The duplicate rows are the intersection between M x M sets with data. It's way easier to do it directly on the file that having to considerate the M x M possible results.*
I'd greatly appreciate any guidance you might offer me.