Skip to content

Am I doing this wrong? I cannot open the file. #3171

Answered by AdamKyle
AdamKyle asked this question in Q&A
Discussion options

You must be logged in to vote

So this might not be obvious to those who have this issue but:

    $response = Excel::download(new KingdomsExport, 'kingdoms.xlsx', \Maatwebsite\Excel\Excel::XLSX);
    ob_end_clean();

    return $response;

The trick: ob_end_clean. It seems that the buffer does not get properly cleaned up, so there is an extra space added. But doing this, the file downloaded and was able to be opened.

I hope this helps someone.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@AdamKyle
Comment options

Comment options

You must be logged in to vote
1 reply
@CR1ST14ANO
Comment options

Answer selected by AdamKyle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants