Link to home
Start Free TrialLog in
Avatar of Errol Farro
Errol FarroFlag for Aruba

asked on

Cfspreadsheet to write to DOWNLOADS folder on loca PC

What is CFPREADSHEET syntax to have CF generate an Excel spreadsheet  on the local PC in folder DOWNLOADS ?
Avatar of _agx_
_agx_
Flag of United States of America image

Depends on the source of the data and whether you need special formatting, but you can find a simple example in the docs. Just update the "fileName" path as needed.


<!--- get some sample data --->
<cfquery name="getCourses" datasource="cfdocexamples">
   SELECT CORNUMBER,DEPT_ID,COURSE_ID,CORNAME
   FROM COURSELIST
</cfquery>

<!--- Write the query to a file --->
<cfspreadsheet action="write"
    filename="c:\path\to\downloadsFolder\someFile.xls"
    query="getCourses"  
    sheetname="courses"
    overwrite="true">
Avatar of Errol Farro

ASKER

The CF runs on a server and is being access from a local PC.

When creating an Excel using <cfcontent type="application/msexcel"> <cfheader name="Content-Disposition" value="filename=Results.xls">, the Results.xls file is always created on the local PC in the Downloads directory.

How can I get the same behavior using CFPSREADsheet but without specifying filename="C:\Users\userName\Downloads" where userName is the user who has activated the CF application?
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial