@petrogromovo I'd recommend taking a look at Laravel-Excel. It's built on-top of PhpSpreadsheet, but makes working with Laravel much easier. You can export from Collections, Arrays, even views. Mapping the data, with header rows is pretty easy, too, which answers your question about needing to manually program it.
For example: https://docs.laravel-excel.com/3.1/exports/mapping.html
The newer versions are OOP based, which I also find nice.