0

I am struggling to find a way to totally remove empty rows from a financial spreadsheet that is created from db results (loop);

I need to remove / delete rows with a calculated row total that equals 0, I first tried hiding rows that have a zero subtotal which works fine but the client wants all zero rows removed not hidden.

Issue is when i use code below it "empties" the row perfectly so all columns are blank but it does not physically DELETE the row, so we just have an empty row that remains.

How do I totally remove the empty row and shift next row up?

spreadsheet image

    $checkvalue = $sheet->getCell($colgroup4_total.$timesheet_row_count)->getCalculatedValue();

    if ($checkvalue == '0') {

        $sheet->removeRow($timesheet_row_count, 1);

    }
  • I do a quick test with removeRow() and it shift next row up... so not sure about what's wrong with your code – Zeikman Feb 06 '23 at 08:48

0 Answers0