Skip to main content
Inspiring
November 10, 2008
Question

Saving Generated Excel Files

  • November 10, 2008
  • 2 replies
  • 446 views
Hi guys,

I have a CF page that is generating an excel file from an html table. ex:

<cfheader name="Content-Disposition" value="inline; filename=excel1.xls">
<cfcontent type="application/vnd.msexcel">
<table border="1" cellpadding="1" cellspacing="2">
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
<tr>
<td>Data1</td>
<td>Data 2</td>
</tr>
</table>

When the page is run, it presents the user with an excel file and asks if they would like to open it or save it. I was wondering if it's possible to save the excel file automatically. So, for instance, I could have scheduled tasks running that generated and saved an excel report without user input. Any idea on how this can be done? I assume it involves cffile in some way but I haven't been able to figure it out. Thanks!
This topic has been closed for replies.

2 replies

Inspiring
November 10, 2008
November 10, 2008
You should be able to do that using "scheduled tasks" in CF Administrator (under Debugging and Logging). Check the "Publish" box (save output to a file) and enter the filename. This would require a specific filename for each scheduled task.

You probably don't even need the cfheader tag to do this but the cfcontent is necessary.

Ken