Create 2 excel files at once
I use this to create a single excel file:
<cfquery database="somedb" name="somequery">
... my query ...
<cfspreadsheet action="write" query="somequery" filename="/C-Items_#custno#_#contractid#.xls" sheetname="temp" overwrite="true">
<cfheader name="Content-Disposition" value="attachment; filename=C-Items_#custno#_#contractid#.xls">
<cfcontent type="application/vnd.ms-excel" file="/C-Items_#custno#_#contractid#.xls" deletefile="yes">
I have found myself in a situation where I need a second excel file created (under certain circumstances).
<cfif filedneeded eq "yes">
... my code above ...
<cfif secondfileneeded eq "yes">
...different query than above, but <cfspreadsheet/cfheader/cfcontent> code similar ...
When I try this I only get the first excel file and not the second ... as if the <cfheader> or <cfcontent> aborts the code and the second <cfif> never runs. I can easily create either spreadsheet from 2 separate links on my page that directs the user to the correct chunk of code, but I'd like to automate this because the need for a second excel file is only sometimes, and my users seems to often forget to click the second link.
Hope that makes sense.