Import and Export Data From Excel Using ColdFusion
page 1 of 5
Published: 14 Apr 2009
Unedited - Community Contributed
Abstract
In this article Debjani discusses the various ways of importing and exporting data between excel sheets and database tables. She uses code snippets along with details explaining the code.
by Debjani Mallick
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 6190/ 201

Introduction

In many web-applications development, we come across the requirement of importing data from tables present in database to excel sheets and vice-versa. This is basically needed when we are  migrating an already existing application, where we would need the already existing data of the application to be stored somewhere and then to be imported into database tables of the new version of the application. Another scenario is when we provide the end user of an web application to download some details or history, like transaction history. In such cases, we can have the data saved to an excel sheet. Though ColdFusion is a tag based language, and we have tags for performing many complex functionalities without knowing any lower level details for those, but there is no direct tag to perform the above operations. There are many solutions to tackle the above issue. One of the easiest solution has been provided by Ben Nadel, the POI Utility. The POI Utility is a ColdFusion component that contains functions to read  excel sheets into queries thus making the data compatible with the ColdFusion, and to write database tables data in the form of queries to excel sheets. This utility provides with the flexibility to populate multiple worksheets of an excel sheet, thus allowing the storage of all the required data in one excel sheet instead of multiple excel sheets. Using this utility, its also possible to provide styling specifications for the excel sheet data to be written from database table data. To take all those advantages, we need to download the POI Utility into our application. But what when we want to perform the above operations without downloading the POI Utility? The answer to this question is that we have many other alternatives to perform the above operations. Here I would be  describing some of the alternatives in detail.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 2 and 3 and type the answer here:

User Comments

Title: instance, a FileOutputStream or ServletOutputStream   
Name: Lance
Date: 6/17/2009 3:00:53 PM
Comment:
Do have an example of how to use ServletOutputStream
Title: Reply: How do you specify sheetname   
Name: Debjani Mallick
Date: 6/11/2009 12:16:21 PM
Comment:
For specifying the arguments using the second write method, the syntax is:
writeExcelSheet('table name','datasource name','path to the excel sheet with sheet name');
This will create a sheet with the default name. Using the second write method, its first of all not possible to specify worksheet names and secondly, its also not possible to write to multiple tabs of an excel sheet through this method. But the first method specified, accomplishes both the tasks.
Title: How do you specify sheetname   
Name: jtansey
Date: 6/11/2009 9:19:14 AM
Comment:
So, in example two of writing to an excel worksheet, it says to specify the fileName as the full path along with the excelsheetname. I need to write to multiple sheets. How exactly do I specify the sheetname?
Title: Good one   
Name: Abx-68
Date: 5/7/2009 4:26:03 AM
Comment:
Good one!! Keep Going
Title: Helpful article   
Name: John
Date: 4/22/2009 11:15:24 AM
Comment:
Thank you for the article. It is really helping.

Product Spotlight
Product Spotlight 






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 11/7/2009 8:11:35 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search