79816580

Date: 2025-11-11 11:34:11
Score: 1
Natty:
Report link

Ok, so, i'm coming here years later, because I had the same problem ("Formula Error: Unexpected operator '&'").

No real answer here, so I tried a few things, and...

I found that I had HTML entities in some cells, like "=&gpt;", and Excel gets it as a formula instead of a "standard string value".

My solution was to change my code from :

$this->Excel->getActiveSheet()->setCellValue($column . $row, $value);

to :

$this->Excel->getActiveSheet()->setCellValueExplicit($column . $row, $value, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

And it worked. Maybe you have the same problem.

Be aware that this workaround only works if you don't WANT formulas in your Excel output, obviously.

Reasons:
  • Whitelisted phrase (-1): it worked
  • Whitelisted phrase (-1): I had the same
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): have the same problem
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Obsidyan