Nov 30, 2023
0
Level 1
How to export multiple sheet in laravel Excel
i have ExcelController:
public function dataList(Request $request){
$data=Mutidbill::select('MUTIDBILL2.TGL_PENCAIRAN','MUTIDBILL2.NPWP','MUTIDBILL2.NO_SPM','MUTIDBILL2.TGL_PENCAIRAN','MUTIDBILL2.NPWPINPUT','MUTIDBILL2.KD_OBJ_PAJAK','MUTIDBILL2.NILBELANJAPJK') ->where('BULAN','=', $request->bulan)->where('TAHUN','=', $request->tahunPph)->get();
return Excel::download(function($excel) use ($data) {
// first Sheet
$excel->sheet('42152223', new ExcelExport($data));
// second Sheet
$excel->sheet('Dasar Pemotongan', new SecondSheetExport($data));
}, 'test.xlsx');
}
and it downloaded and no data in excel. before it i use
return Excel::download(new ExcelExport($data), 'TEST.xlsx');
its work and showed the data, can you find where ther problem? thank you
Please or to participate in this conversation.