I have the following sample line in a CSV file I am generating with PHP. When I cat the file this is what I see:
541787,271561,"04/01/2013 09:26:35",18801872,Many,"PINSTRIPE JACKET",18806821872,75.00,GBP,1,0078,5051916991872
However, when I open this file in MS Excel the “0078” has been changed to “78” – so MS Excel has taken it upon itself to strip the leading zeros. It has also converted the EAN13 number (in Column L) to an exponent.

In terms of the PHP code I am outputting the file to the browser with the following code, which works in principal, but I would like to know if there is a way to control the stripping of the leading zeros with PHP?
// set the headers
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename=_report_' . date('Y-m-d-His') . '.csv');
header('Pragma: no-cache');
echo $report->getCSVOutput();
exit;
It turns out that with a small tweak (as suggested by the owner) to SimpleExcel this package can handle the stripping of leading zeros.
I am using the code below:
The code amendment required me to change the
XMLWriterclass in theaddRowmethod to: