Error opening on Excel
I'm creating a file and when I open that file in Excel appear a message error.
"Excel could not open
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>Reparar resultado pararesultado (1)0.xml</logFileName>
I've tried to change my sheet name and others modifications with any success.
i have same problem
Well, usually this happens when php throws error or warning, and that error gets written to your excel file, and it gets corrupted, but opening it and going through all messages still opens the file and you can see the error message.
In my case it happened because I've set the value of a cell to more than 32767 characters and that is a maximum for Excel 2007 format.
I use PHP_XLSXWriter in a laravel project.
For me, this error was generated by the output of the Debugbar, which was added to the excel file.
Setting
APP_DEBUG=false
in the .env file or adding
app('debugbar')->disable();
to the export script helped
I encountered the issue when the data did not match the format code. We had several numeric columns ("0" and "0.00"), but not only one header line but two. The second header line contained texts that caused the warning in Excel.
My solution was to inherit from XLSXWriter and create a modified version of writeSheetRow -> writeSheetRowWithFormats that allows for setting custom data formats (text, "@" in that case). Solved the problem.