By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,646 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,646 IT Pros & Developers. It's quick & easy.

ODBC, Excel, JScript ... where is the synergy?

P: 1
Hello All,

First post here ... :-)

I read so many articles/tutorials about this "simple" method to retrieve data from an excel sheet and did everything by the book, however, it does not work for me, I keep getting "Could not find installable ISAM"

Usually at this stage I refer to Google in order to find suitable solution ... but not in this case. In this case there are so many "so called" solutions that give advises but could not solve this issue. Now, after reading many articles with different ways to solve this issue (including registry edits, modifying the connection string and even installing Office on my server) I keep getting the same error mesage: "Could not find installable ISAM".

I'm working with an updated Win 2003 Server and this is my code:
Expand|Select|Wrap|Line Numbers
  1. var aVals;
  2. var sConnection="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\\website\\files\\data_excel.xls;Extended Properties=\"Excel11.0; HDR=No; IMEX=1;\"";
  3. var sSQL="SELECT * FROM [sheet$];";
  4. var oADO=Server.CreateObject("ADODB.Connection");
  5. oADO.Open(sConnection);//<--- this line gives the error
  6. var rsSheet=oADO.Execute(sSQL);
  7. if(!rsSheet.EOF){
  8.     aVals=rsSheet.GetRows();
  9.     aVals=aVals.toArray();
  10.     var colCount=rsSheet.Fields.count;
  11. }
  12. rsSheet.Close();
  13. rsSheet=null;
  14. oADO.Close();
  15. oADO=null;
  17. if(!aVals){
  18.     Response.Write("The worksheet is blank.");
  19.     Response.End();
  20. }else{
  21.     Response.Write("<table>");
  22.     for(y=0;y<aVals.length;y+=colCount){
  23.         Response.Write("<tr>");
  24.         for(x=0;x<colCount;x++){
  25.             Response.Write("<td>"+aVals[x+y]+"</td>");
  26.         }
  27.         Response.Write("</tr>");
  28.     }
  29.     Response.Write("</table>");
  30. }
BTW, when trying the folowing connection string the code works fine ...
Expand|Select|Wrap|Line Numbers
  1. var sConnection="Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=c:\\website\\files\\data_excel.xls";
Second issue would be to retrieve the worksheet name, I need it for the SQL query and have no idea how to get it.

Last issue for today (and only because of the first problem), I can't seems to retrieve the column name with the current connection string, is there a way to do it?

Thanks in advance
Jun 8 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.