Excel file creation failure in laravel

By | March 17, 2018

PHPExcel_Calculation_Exception in Cell.php line 293,Formula Error:am unexpected error occured

Error Scenario: This error usually throws because of special characters.if that characters are reserved words in the excel formula calculation. i got this error in one of my application.excel files created using large set of data. In this one of the field start with symbol (=) equal to.This time download option is not working

Solution: i tried and searched the solutions for this.i made it as the character replacement.if the first charcter is =,then append one more reliable character(i used ~) at the begining

For example

we can use the $newval in the excel creation