Solved

Coldfusion Excel Datasource reading in blank string when a number is encountered

Posted on 2008-10-01
7
422 Views
Last Modified: 2013-12-24
I have an excel 5.0/95 spreadsheet set up as a datasource for a Coldfusion script. It can read from the file using the following SQL command:

select password from [worksheet$] in 'C:\datasources\sheet.xls' 'EXCEL 5.0;';

And then I dump it using cfdump.

The problem is that when it encounters a number in the sheet, it does not read it in and displays '[empty string]'. I have tried formatting the column as both text and general and it does not seem to make any difference. I know that I can fix the problem by putting a single quote mark in front of the number in the spreadsheet, but this is not a practical solution as this is a regular task and will take a lot of time to go through and do this each time. I need to find a programatic solution.

Any suggestions?
0
Comment
Question by:dale_abrams
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22618215
0
 
LVL 1

Author Comment

by:dale_abrams
ID: 22619298
Thanks Erik.

I tried the solution on that page and am getting a syntax error in the from clause.

Here is the new query that I tried...


select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\datasources\sheet.xls;HDR=Yes;IMEX=1', 

'select * from [worksheet$]');

Open in new window

0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22619361
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:dale_abrams
ID: 22619508
That forum did not apply to my problem.

I was able to find my solution on a different site through google searching though. The final working query was

SELECT * FROM "Excel 8.0; DATABASE=C:\datasources\sheet.xls; HDR=YES;IMEX=1".[worksheet$];
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22621080
the link that i posted very closely shows the solution. And it was a big help to you
0
 
LVL 1

Accepted Solution

by:
dale_abrams earned 0 total points
ID: 22621290
The link you posted utilized a completely different method, and after trying that method and running into a whole new set of roadblocks, I went and searched and found an answer myself. I appreciate your help, but would ask that you do more than search the forums and post a link. That defeats the purpose of having a site like Experts-Exchange where people can get direct code examples to their questions. Had you taken the time to do this, I would have given you partial points for taking the time to attempt to help me.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now