I have an array PHP and I want to convert in an object SpreadsheetPhp; I use a library about SpreadsheetPhp. I have tried with some method but if, for example, I wrote:
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($result, "Xls");
and $result is a array, I have the error because $result
isn't a object.
I have this error:
Uncaught TypeError: Argument 1 passed to PhpOffice\PhpSpreadsheet\IOFactory::createWriter() must be an instance of PhpOffice\PhpSpreadsheet\Spreadsheet, array given, called in C:\xampp3\htdocs\sincro\parts_europe.php on line 166 and defined in C:\xampp3\htdocs\sincro\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\IOFactory.php:47 Stack trace: #0 C:\xampp3\htdocs\sincro\parts_europe.php(166): PhpOffice\PhpSpreadsheet\IOFactory::createWriter(Array, 'Xls') #1 {main} thrown in C:\xampp3\htdocs\sincro\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\IOFactory.php on line 47
Thanks