Urgent!!!!!!!!! export to excel

Posted on 2006-05-15
Last Modified: 2013-12-24
I've having problem to export to excel on web. when user open the file.

Name, age
Smith Hunter  35

This will become three clolumns. it should be Smith,Hunter 35

Can someone tell me how to do the query?

select '"' name ||'",||age

#name,#age (also it seems that it couldn't find name and age from the query
Question by:nightworker
    1 Comment
    LVL 35

    Accepted Solution

    Simply create a table in the page

    <cfquery datasource="#YourDSN#" name="GetRecords">
    SELECT Name, Age FROM mytable
    <cfheader name="content-disposition" value="inline;filename=Results.xls">
    <cfcontent type="application/msexcel">
    <table border="1">
          <cfoutput query="GetRecords">

    That is the entire page.

    Also note you should not used reserved words like "Name" as any column names.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now