Please tell me how you can skip lines that contain the value NULL. I'm trying to build a price list based on another Excel file. And there is a need to skip blank lines.
for ($row = 5; $row <= $highestRow; $row++) { $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); if ($row == 5) { continue; } $export->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $rowData[0][2]); $export->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $rowData[0][3]); } That's it in the value of $ row, $ rowData [0] [2]; slips null
NULLand docontinue? What is the problem? - robertobadjioif (isset($row, $rowData[0][2])) { $export->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $rowData[0][2]); $export->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $rowData[0][3]); }if (isset($row, $rowData[0][2])) { $export->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $rowData[0][2]); $export->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $rowData[0][3]); }if (isset($row, $rowData[0][2])) { $export->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $rowData[0][2]); $export->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $rowData[0][3]); }That is, if both of these variables are NOT null, then perform the action. - Edward$row. Added answer - robertobadjio