a very handy php function fgetcsv and fputcsv


header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv; filename=document_" . date("Ymd") .".csv");

http://www.modwest.com/help/kb6-135.html
http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm