Untitled
foreach ($queryAll as $record) { $rowData = [ // In the column A wil be written value from field 'number' 'A' => trim($record['nokas']), // In the column B wil be written value from field 'description' 'B' => trim($record['uraian']). PHP_EOL . trim($record['uraian2']), // And so on... 'C' => trim($record['kdref']), 'D' =>(float) $record['penerimaan'], 'E' => (float) $record['pengeluaran'], ]; if ($count++ === 0) { // First we replace the row 6 (this is template row) $sheet->replaceRow(13, $rowTemplate, $rowData); } else { // Then we add new rows after last touched $sheet->insertRowAfterLast($rowTemplate, $rowData); } } $excel->save();
Leave a Comment