When 'exporting' data to XL I found XL ignored csv files and only opened tab-delimited text files with a
Header ('Content-Type: application/vnd.ms-excel');
instruction. So basically, you need to loop through each record, seperating fields by tabs and lines with \n. Hope this helps.