Solved

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

Posted on 2008-10-01
7
431 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
[X]
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
  • 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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

728 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