Troubleshoot downloads

Most libraries like PHPSpreadSheet seems to use PHP buffer. And depending on your PHP configuration some warnings or errors could interfer with the output.

Let’s examine the output before the Excel-file is written:


$writer = new Xlsx($spreadsheet);

// hello-world.xlsx no longer corrupt

If this works, you have something in your output buffer already. Let’s find it.


// "\n"

A blank line, let’s find and remove it. Somewhere the is probably a php-file that starts with a blank line.