addSheet($swapCount,'Swap Count'); $xlsx->downloadAs('swap_report.xlsx'); // This will download the file to your local system // $xlsx->saveAs('swap_report.xlsx'); // This will save the file to your server echo "
"; print_r($swaps); print_r($swapCount);