Solved

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

Posted on 2008-10-01
7
426 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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 viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

810 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