I've spent days trying to set up a simple export to a .csv file with no luck. 
cffile keeps saving it in html format so I'm using another solution I found 
online. It seems to work a lot better than cffile, but when I open the .csv 
file in MS Excel, every other row is blank. When I open it with notepad, every 
other line is just comma's. I have no idea where these extra rows of comma's 
are coming from. If anyone can help, it would be greatly appreciated. Here's my 
code:

<cfquery name="qMembers" datasource="#Application.Datasource#">
    SELECT id, first_name, middle_initial, last_name, title, company, 
agent_team_name, company_address1, company_address2, company_city, 
company_state, company_zip, company_phone, company_phone_ext, company_cell, 
company_email, company_fax, company_website, join_date, media_center_on_site
    FROM vErniesExport
</cfquery>
<cfsetting enablecfoutputonly="yes">
<cfset delim=44>
<cfcontent type='application/vnd.ms-excel'>
<cfheader name="content-disposition" value="filename=Ernies_Export_#today#.csv">
<cfoutput> ID#chr(delim) #First Name#chr(delim) #Middle Initial#chr(delim) 
#Last Name#chr(delim) #Title#chr(delim) #Company#chr(delim) #Agent/Team 
Name#chr(delim) #Company Address 1#chr(delim) #Company Address 2#chr(delim) 
#Company City#chr(delim) #Company State#chr(delim) #Company Zip#chr(delim) 
#Company Phone#chr(delim) #Company Phone Ext.#chr(delim) #Company 
Cell#chr(delim) #Company Email#chr(delim) #Company Fax#chr(delim) #Company 
Website#chr(delim) #Join Date#chr(delim) #Resource Center On-Site</cfoutput>
<cfoutput query="qMembers">
#id##chr(delim) #"#first_name#"#chr(delim) #"#middle_initial#"#chr(delim) 
#"#last_name#"#chr(delim) #"#title#"#chr(delim) #"#company#"#chr(delim) 
#"#agent_team_name#"#chr(delim) #"#company_address1#"#chr(delim) 
#"#company_address2#"#chr(delim) #"#company_city#"#chr(delim) 
#"#company_state#"#chr(delim) #"#company_zip#"#chr(delim) 
#"#company_phone#"#chr(delim) #"#company_phone_ext#"#chr(delim) 
#"#company_cell#"#chr(delim) #"#company_email#"#chr(delim) 
#"#company_fax#"#chr(delim) #"#company_website#"#chr(delim) 
#"#DateFormat(join_date, 'm/d/yyyy')#"#chr(delim) 
#"#DateFormat(media_center_on_site, 'm/d/yyyy')#"
</cfoutput>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323673
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to