For each table, something like: <cfloop query="ExportData">
<cfloop list="#ExportData.columnList#" index="col"> <!--- columnList is a variable that is present in every query - a comma seperated list of column names ---> <cfset output = output & #ExportData[col]# & ' '> <!--- this will need to change to reflect the way you are making the excel file ---> </cfloop> <cfset output = output & chr(13) & chr(10)> <!--- I wouldn't do a file append on each loop, just keep building the string and add a line break to it ---> </cfloop> <cffile action="write" file="#tempfile#" output="#output#" nameconflict="overwrite"> <cfmail ...> <!--- not sure how you attach a file offhand, look it up! ---> </cfmail> <!--- no need to delete the file, because you can choose to overwrite it the next time you run the process. Easy to delete tho: ---> <cffile action="delete" file="#tempFile#"> Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297402 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

