Solved

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

Posted on 2008-10-01
7
428 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
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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…

763 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