PHP_XLSXWriter icon indicating copy to clipboard operation
PHP_XLSXWriter copied to clipboard

Error opening on Excel

Open rafaelSallowicz opened this issue 8 years ago • 5 comments

I'm creating a file and when I open that file in Excel appear a message error. "Excel could not open .xlsx. Do you want to open a repair this workbook?" Clicking 'open and repair' allows the file to be opened without any noticeable modifications and then show me the logs.

<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>Reparar resultado pararesultado (1)0.xml</logFileName>

Erros detectados no arquivo '/Users/rafaelsallowicz/Downloads/resultado (1).xlsx'<repairedRecords summary="A lista a seguir é de reparos:"><repairedRecord>Registros Reparados: Informações sobre a célula de /xl/worksheets/sheet1.xml</repairedRecord></repairedRecords></recoveryLog>

I've tried to change my sheet name and others modifications with any success.

rafaelSallowicz avatar Aug 25 '17 13:08 rafaelSallowicz

i have same problem

zaartix avatar Sep 02 '17 11:09 zaartix

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.

startas avatar Sep 06 '17 10:09 startas

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.

premax avatar Sep 14 '17 21:09 premax

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

ritterg avatar Jan 19 '18 17:01 ritterg

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.

BurninLeo avatar Jul 12 '21 09:07 BurninLeo