Thanks for your input.
However, I am getting the following error below.
Any ideas?
I am using SQL Server 2005 and ColdFusion 8.0.
I am doing my best to try to read an Excel file using ColdFusion.
The problem is, if I try to load this data:
LOGICAL_CIRCUIT BUSINESS BUC
TEST_CIRCUIT 666666 D47147
TEST_CIRCUIT 666666 6666666
I get these results:
BUC BUSINESS LOGICAL_CIRCUIT
[empty string] 666666 TEST_CIRCUIT
6666666 666666 TEST_CIRCUIT
As you can see, the business and logical_circuit fields loaded fine. However, the buc field, because it contained a mixture of numbers and strings, only will load the numeric values, and the string 'D47147' is converted to empty string.
This is all in spite of me trying various combinations of data formatting in the spreadsheet. Currently, everything is set as text.
Here is my code:
<cfquery name="qryXLSdata" datasource="psm_excel">
SELECT logical_circuit, business, buc FROM [PSM_TEMPLATE_1$]
IN 'C:\the\path\to\#cffile.se
</cfquery>
psm_excel is a dummy datasource that points to an empty access file.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Are you using a db on the SQL server for the datasource name in your cfquery tag? If you are using an excel or access dsn it will probably throw an error.
Check the query itself in a query analyzer. Also, you are missing the IMEX=1. That's what is going to prevent the NULL value for the D47147 value in BUC column.
Thanks, that got me past that error.
Now I have one more error as below.
Question is, does the path to the spreadsheet have to be relative to the ColdFusion server, or relative to the SQL Server?
The spreadsheet I am referring to is on the same machine as the ColdFusion server, not the SQL server.
Thanks.
relative to the sql server, but you can use \\Servername\Sharename\Pat
If you still get the same error here are some posts regarding it:
http://forums.microsoft.co
Business Accounts
Answer for Membership
by: mtgenusPosted on 2008-08-13 at 14:40:59ID: 22225888
If you are using SQL server then use OPENROWSET to read the excel file, for example:
OLEDB.4.0' , 'Excel 8.0;Database=C:\the\path\t o\#cffile. serverFile #;HDR=Yes; IMEX=1',
<cfquery name="qryXLSdata" datasource="your_db_name">
SELECT logical_circuit, business, buc
FROM OPENROWSET('Microsoft.Jet.
'SELECT *
FROM [Sheet1$]
Where LOGICAL_CIRCUIT is not null ' )
</cfquery>
If you are not using SQL server then you should be able to use coldfusion to save the excel file as a text file and parse it.
Lastly, you can download and use a custom tag, such as cfx_excel2query, which works pretty good, as well.
Thanks
the sheet name has to match the name of the excel file sheet (Sheet1$), also, you can select specific rows/columns by adding the range after the sheet name. For example, [Sheet1$A2:I50000]
Hope this helps