[Webinar] Learn how to a build a cloud-first strategyRegister Now


How to have a query output to Excel without listing every field?

Posted on 2006-03-24
Medium Priority
Last Modified: 2013-12-24

I have two parts to this question:
1.  How can I export my query to Excel when the user clicks on the link to the page with the query in it.
2.  Is it possible to not have to list all the fields in the query for the output on the query page?

I Have some simple reports to do.  The table has probably about 40 fields.
I do not want to list the query and then list all the fields in the query for output.
I want to do the list of the query results dynamically.
Question by:g118481
  • 2
LVL 25

Accepted Solution

dgrafx earned 2000 total points
ID: 16279531
Try this on the page you want to export to excel
<cfcontent type="application/excel">
<cfheader name="Content-Disposition" value="filename=Results.xls">

Do you mean for part 2 that you want to display x number of fields on your query page, but not export all of them to excel?
If thats what you mean then on your query page you'll have a link that says "click here to output to excel" or whatever
add a target value to the link which would be a hidden iFrame where you do a different query that contains only the fields you want output to excel.
The above cfcontent & cfheader would need to be on this hidden iFrame page

Author Comment

ID: 16289698
I cannot use the cfcontent tag on my host site.
Is there another way to export my cfquery to excel?
LVL 25

Expert Comment

ID: 16289855
not that I know of using ColdFusion.
Although there may be a custom tag available somewhere.
But if your host won't allow cfcontent, then they probably don't allow custom tags.

Get a new host!
There are several very affordable ColdFusion hosts who do not put restrictions on you.
Your current host not allowing certain tags really means that they don't know how to configure each customers sandbox correctly so they just apply a blanket restriction.

Good luck ...

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question