I have done multiples tests on a simple PHP page and it works pretty well. PhpSpreadsheet is pretty cool.
Then I wanted to add my code as a function to call it whenever I need to. However, I get this error now :
syntax error, unexpected 'use' (T_USE)
. I'm not very familiar with the use
command and I don't understand this error as well.
Here is the part which is getting an error (basically the start) :
function exportCSV($idNote) {
require './vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
...
}