I\'m using a php script to generate an excel CSV file from a result-set query. All works fine but when i read my excel file, I can not display leading zeros.
this is
Try casting it to string like:
fputcsv($fp, (string) $val);
OR, Opening XLS file will truncate leading 0 so try adding /t before zero to avoid 0 truncation while creating your row values.