How do I read Excel files in Coldfusion

Posted on 2004-10-06
Last Modified: 2013-12-20
After much searching I have decided to join EE so I might be able to solve my problem.

I got some code from my fellow developers to read a Excel file in Coldfusion but it no longer works in MX

<cfquery dbtype="dynamic" CONNECTSTRING="Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=#Session.filepath#;DefaultDir=#Session.filepath#;" name="InputQuery">

Then I managed to find some COM object thing that is a Custom tag that suppose to do the same thing..{ReadXLS.cfm} but it also doesn't work

Is there anybody out there that can actually do this?

Custom Tag / CFFile / CFQuery .. I don't care.. I just need to get the excel file read into CF, after that I will split the data and validate it and write a text file out to do the rest of my process.. In a perfect world I would ask the end-users to actually save the Data Dumps as CSV but I can't and they will not do this... So I need to somehow read the DATA from the Excel file.

My next option is to just do it in PHP... but that would require a whole new system.. and I would rather find a solution to my current problem than re-write everything in PHP

Kind Regards
Question by:Adesso21
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
LVL 21

Accepted Solution

pinaldave earned 125 total points
ID: 12239850

Expert Comment

ID: 12244824
DNS-less connection is no longer supported in MX.

This site shows you some workarounds
With the introduction of JDBC drivers in ColdFusion MX, dynamic data source connections (also referred to as DSN-less connections) are no longer supported. This is because ColdFusion MX uses the data source services provided by the underlying J2EE server. It is possible to closely simulate this functionality however.

Dynamic data sources in ColdFusion MX

Expert Comment

ID: 12244854
<cfquery dbtype="dynamic" CONNECTSTRING="Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=#Session.filepath#;DefaultDir=#Session.filepath#;" name="InputQuery">

is not supported anymore.

Either create an odbc and setup the administration area for the ODBC,
then change your <cfquery> to sumthing like
<cfquery name="InputQuery" datasource="Your_dnsname">

or use the workaround given by macromedia and modify your all queries
 like this
<cfquery name="test" datasource="dynamicMDB">
   SELECT FirstName
   FROM Employees
   IN 'C:\mysite\db\cfsnippets.mdb'

i would personally go for step one.
Setup the ODBC then modify the <cfquery tags>
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!


Author Comment

ID: 12246502
DNS-less connections is no longer supported...... NOT has a very nice solution to make this all possible..

The requirment was reading in files on a server in a on-going basis.. and this nice little CFX tag does just that.. no more worries as my problem has been solve thanks to pinaldave. I knew it was not all that tuff..

Thanks for the link and time guys.. My work here is done.

Kind Regards


Author Comment

ID: 12246540
PS > no longer exist...
LVL 21

Expert Comment

ID: 12248706
glad to help you and have a good day,

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

631 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