Pages

Wednesday, September 4, 2013

How to Dump From ColdFusion to Excel

How to Dump From ColdFusion to Excel

Adobe ColdFusion is a rapid application development platform designed for the simple integration of HTML and ODBC databases. Its markup language closely resembles HTML in syntax and contains many built-in tags that greatly compress the manipulation of records in a database, be it through creation, retrieval, updating, or deletion. One such built-in tag allows you to query a database and dump all or part of the results into an Excel spreadsheet.

Instructions

    1

    Create a new ColdFusion page in your preferred text editor.

    2

    Add the following code, the block HTML output to your spreadsheet:

    3

    Add the that you are dumping to Excel at the beginning of the document. As an example, assume you are working with the following query:

    SELECT * FROM Employee

    4

    Add the following code beneath the closing tag:

    Substitute your preferred filename for Employees.xls.

    5

    Format the output of your query in table form using a tag within a tag, as seen below:

    Emp_ID FirstName LastName

    Substitute the number that is one higher than the number of variables you are dumping for the value of "cols", your query name for "GetEmps," and the names of the variables for the variables shown in each respective table cell.

    6

    Save and publish your ColdFusion web page and open it in your web browser. Once the page has completely loaded, delete the filename and extension from your address bar and replace it with the filename you supplied for the Excel spreadsheet in Step 4. Hit the "Enter" key and your web browser will access the new spreadsheet you have just created.

0 comments:

Post a Comment