exporting data to a comma dilimeted file

Discussion in 'Programming' started by catbollu@msn.com, Oct 18, 2005.

  1. #1
    Is there a way with coldfusion to take data and export to a comma delimited file. I would use excel but too much data.
     
    catbollu@msn.com, Oct 18, 2005 IP
  2. durango

    durango Guest

    Messages:
    83
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could use the CFCONTENT tag to do something like this:

    
    <cfsilent>
      <cfquery datasource="MyDatasource" name="MyQuery">
        select * from table
      </cfquery>
    </cfsilent><cfcontent type="text/csv"><cfheader name="Content-Disposition" value="attachment; filename=export.csv">
    <cfoutput query="MyQuery">#column1#,#column2#,#column3##Chr(13)#</cfoutput>
    
    Code (markup):
     
    durango, Oct 18, 2005 IP