addSheet($userCount,'User Count')->addSheet($swaps,'Swap')->addSheet($swapCount,'Swap Count')->addSheet($recharges,'Recharge')->addSheet($rechargeCount,'Recharge Count')->addSheet($services,'Service')->addSheet($assets,'Asset'); $xlsx->downloadAs('report.xlsx'); // This will download the file to your local system // $xlsx->saveAs('report.xlsx'); // This will save the file to your server echo "
"; print_r($users); print_r($userCount); print_r($swaps); print_r($swapCount); print_r($recharges); print_r($rechargeCount); print_r($services); print_r($assets);