I am trying to export a (query structured) table (called formal) to excel using laravel. So far I can show table in browser as html using this blade. I want when user presses Export to excel button to export to excel (my blade is below):
<!DOCTYPE html>
<html lang="el">
<head>
<meta charset="UTF-8">
<title>Studies</title>
</head>
<body>
<b>Schedule: {{ $key }}</b>
<br>
<table border="1">
<tr>
<th>Lesson Category</th>
<th>Lesson Code</th>
<th>Lesson Title</th>
<th>Lesson Department</th>
/* extra columns
....
*/
<th>Audience</th>
</tr>
@foreach($star as $v2)
<tr>
<th>{{ $v2->lesson_category }}</th>
<td>{{ $v2->lesson_code }}</td>
<td>{{ $v2->lesson_title }}</td>
<td>{{ $v2->lesson_dep }}</td>
/* extra columns
....
*/
<td>{{ $v2->audience}}</td>
</tr>
@endforeach
</table>
<br>
<form action='/programma'>
<input type="submit" value="New Search" />
</form>
<br>
<form action='/export'>
<input type="submit" value="Export to excel" /> //I want this button to
//export to excel
</form>
</body>
</html>
I have followed this guide with no success. https://docs.laravel-excel.com/3.1/getting-started/installation.html https://docs.laravel-excel.com/3.1/exports/
The maatwebsite/excel has been installed successfully. But no excel is downloaded.
/export
route? – dparoli