C пакетом maatwebsite/excel не работал, но есть пример с phpexcel
let requestParams = {
method: 'get',
url: 'some-url',
responseType: 'blob',
};
axios.request(requestParams)
.then({data} => {
let filename = '123' + (Math.floor(Date.now() / 1000)) + '.xlsx';
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }));
let link = document.createElement('a');
link.href = url;
link.setAttribute('download', filename);
document.body.appendChild(link);
link.click();
link.remove();
});
На backend
$oSpreadsheet = new Spreadsheet();
// TODO что-то делаем с $oSpreadsheet заполняем данными
$oWriter = IOFactory::createWriter($oSpreadsheet, 'Xlsx');
$sFilename = '123.xlsx';
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $sFilename . '"');
header('Cache-Control: max-age=0');
$oWriter->save('php://output');
exit;