LARAVEL动态创建使用phpexcel的excel文件

时间:2017-08-30 11:32:37

标签: laravel phpexcel export-to-excel

如何制作这样的表格,使用phpexcel,以及动态的日期和月份?

Screenshot

1 个答案:

答案 0 :(得分:0)

$excelData[] = ['Report']; 
$data = $user->get();
$grandTotal = 0;
$verticalCount = [];
$verticalCount['S. No'] = '';
$verticalCount['Name'] = 'Total';
$keys = [];

foreach($data as $d=>$k){
        $_excelData = [
            "S. No" => $d + 1,
            "Name Of Admin" => $k->name
        ];

//$dates containing date of given time period 
foreach ($dates as $date) {
            $_excelData[$date] += 1;
            $verticalCount[$date] += 1;
        }

    }