Design903

Coldfusion 9 - cfspreadsheet tag

In the past when I needed to create a data export and dump it to a csv/xls file, I would create a file then loop through the query and append each line of data. This was not a hard task and did not take too many lines of code.

However, with ColdFusion 9 this task can be done with one line of code using the cfspreadsheet tag.



Here is a quick example, where "yourqueryname" is the name you gave your query object:

<cfspreadsheet action="write" filename = "#ExpandPath( 'export\' )#filename.xls" overwrite = "true" query = "yourqueryname">

CF simply writes the xls file to the location you told it to in the filename parameter.

Related Blog Entries

Comments
John Smith's Gravatar It's a very power full and informative post, Every one learn from it.
# Posted By John Smith | 6/28/11 9:52 AM
Web Design Company Serving:

Longview
Tyler
Kilgore
Marshall
Jefferson
Texarkana
Nacogdoches
Lufkin
East Texas

© 2009 JMP Consulting, Inc. dba Design903 - Longview, Texas Web Design

Home | Contact Us | Site Map | Work | Services | Pricing