macromedia.coldfusion.getting_started
[Top] [All Lists]

Re: Writing a CSV file

Subject: Re: Writing a CSV file
From: Ian Skinner
Date: Tue, 15 Apr 2008 10:47:09 -0700
Newsgroups: macromedia.coldfusion.getting_started


tclaremont wrote:
Here is the way I do it...

 <cfquery name="GetAll" datasource="#DSN#">
 SELECT Field1, Field2, Field3, Field4
 FROM tblName
 </cfquery>


 <cfheader name="Content-Disposition" value="filename=ReportName.csv">
 <CFCONTENT  reset="yes" TYPE="application/msexcel">
 <CFOUTPUT QUERY="GetAll">
 "#GetAll.Field1#","#GetAll.Field2#","#GetAll.Field3#","#GetAll.Field4#"
 </cfoutput>



It should be noted that this solution sends a file to the client browser which most would recognize as an Excel file and bring up an open or save dialog box for this.

The original poster was talking about just writing a csv text file to the server. I have never had trouble doing this, but it sounds like some of your data may be unusually large numbers. How exactly are you writing the file? What does the file look like before excel gets its hands on it? I.E. what does it look like in a plain text editor such as notepad.


<Prev in Thread] Current Thread [Next in Thread>