I have created excel files on my server with phpspreadsheet and I have sent them as attachements in a email message. Now, I am trying to save those excel files directly on clients. I have tried with this php script:
$respuesta = new Response();
$respuesta->setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
$respuesta->setHeader('Content-Disposition', "attachment; filename='" . $filename ."'");
$respuesta->setHeader('Cache-Control: cache, must-revalidate');
$writer->save('php://output');