wvalencia
asked on
COLDFUSION EXPORT TO EXCEL - WRONG FILENAME
I am trying to export some data into a excel spreadsheet using ColdFusion. The export works perfect but always the export file is called like "index.cfm" instead my temp file which is tempfile.xls. Below is the code I am using.
QUERY COMES FIRST
<CFSET tempfile = "C:\temp\exptemp.xls">
<CFSET output = "">
<CFSET output = output & "Card_Name Lot_Number Seq_Number Face_Value Pin_Cost FU_DateTime">
<CFFILE ACTION="WRITE"
FILE="#tempfile#"
OUTPUT="#output#">
<CFLOOP QUERY="exp_fu">
<CFSET output = "">
<CFSET output = output & "#card_brand_name# #lot_num# #seq_num# #face_value# #customer_cost# #dateformat(fu_date, 'mm/dd/yy HH:mm:ss')#">
<CFFILE ACTION="APPEND" FILE="#tempfile#" OUTPUT="#output#">
</CFLOOP>
<CFCONTENT TYPE="application/msexcel" FILE="#Tempfile#">
QUERY COMES FIRST
<CFSET tempfile = "C:\temp\exptemp.xls">
<CFSET output = "">
<CFSET output = output & "Card_Name Lot_Number Seq_Number Face_Value Pin_Cost FU_DateTime">
<CFFILE ACTION="WRITE"
FILE="#tempfile#"
OUTPUT="#output#">
<CFLOOP QUERY="exp_fu">
<CFSET output = "">
<CFSET output = output & "#card_brand_name# #lot_num# #seq_num# #face_value# #customer_cost# #dateformat(fu_date, 'mm/dd/yy HH:mm:ss')#">
<CFFILE ACTION="APPEND" FILE="#tempfile#" OUTPUT="#output#">
</CFLOOP>
<CFCONTENT TYPE="application/msexcel"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.