Jump to content

Export to CSV


947740

Recommended Posts

I am having some trouble exporting a file as a csv.  I have this code:

<?php
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");
?>

 

And, in that file, there is this data:

1163 6/13/2009 162 10.36

944 6/13/2009 162 10.31

929 6/13/2009 162 10.33

1034 6/13/2009 162 7.44

 

But it is not working.  Excel says it is not a valid .csv file.  I have a feeling that the header content I am sending is not correct.  What am I missing?

Link to comment
https://forums.phpfreaks.com/topic/161528-export-to-csv/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.