How can I write data into an excel using PHP?
You can try and create a CSV file, like this:
name;surname;blabla
name;surname;blabla
name;surname;blabla
name;surname;blabla
Excel should eat this :)
It is convenient to use PHP CVS functions: http://php.net/manual/en/function.fputcsv.php
You can use the PhpSpreadsheet library, to read an existing Excel file, add new rows/columns to it, then write it back as a real Excel file.
Disclaimer: I am one of the authors of this library.