0

I get the following error and I'm trying to figure out if it's something in my code or if my template is causing the error. I can upload the template if needed, but thought I'd check if I've missed something obvious or if this is a known problem first.

Notice: Undefined offset: 2 in /vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 3472

Warning: trim() expects parameter 1 to be string, array given in /vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 3680

require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load("template.xlsx");

$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save('php://output');
exit;

Edit// I tried a different template and I don't get the error, so template can be found here...

SeaBass
  • 1,584
  • 4
  • 20
  • 46
  • You can't use `trim` on an array. It must be a string. The code you're displaying is not related to the error. There is no `2` index, nor a `trim` call. – user3783243 Apr 28 '19 at 18:51
  • Yes, well it’s baked into the PhpSpreadsheet, so something in my template can’t be read properly by PhpSpreadsheet. Should I just report that as a bug to them then? – SeaBass Apr 28 '19 at 18:53
  • Any ideas? Thank you!! – SeaBass May 14 '19 at 18:30

0 Answers0