addSheet($userCount,'User Count'); $xlsx->downloadAs('users_report.xlsx'); // This will download the file to your local system // $xlsx->saveAs('users_report.xlsx'); // This will save the file to your server echo "
"; print_r($users); print_r($userCount);