Re: CSV output displayed in Excel or similar.

From: Date: Thu, 29 Nov 2001 20:10:18 +0000
Subject: Re: CSV output displayed in Excel or similar.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-76093@lists.php.net to get a copy of this message
I have had success using tab delimted files instead of comma delimited files. For some reason Excel does not behave as expected when opening csv files from the web. At least, it acts differently than it does when opening them from the local disk. At any rate, I use tabs to delimit fields and new lines to delimit rows and it opens in Excel as expected, with one exception. All numbers are treated as numbers even if they are enclosed in qoutes. The result it that "0009" is rendered as 9 in Excel. Again, this does not happen if the file is first saved, because Excel asks how to treat the fields. Fred Matthew Clark <matt@genicomsystems.com> wrote in message news:ONEDKKGEOLNHBPDFPGPKIEHEHLAA.matt@genicomsystems.com... > I have a PHP script that outputs several lines of comma separated values.. I > would like to display this output in Excel without having to write the > output to a file with a .csv extension and redirecting. > > I have tried setting the content-type: application/vnd.ms-excel and Excel > isn't happy.. it complains that it can't open the file and on the odd chance > that I do get it working, it doesn't read the file as csv.. > > anyone know what's going wrong here?? > > Incidentally, if I do save the info down to a .csv and open it, it works > just fine.. but then I have a temporary file issue :-( > > Regards, > > Matthew Clark. >

« previous php.general (#76093) next »