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:
Code:
-
var aVals;
-
var sConnection="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\\website\\files\\data_excel.xls;Extended Properties=\"Excel11.0; HDR=No; IMEX=1;\"";
-
var sSQL="SELECT * FROM [sheet$];";
-
var oADO=Server.CreateObject("ADODB.Connection");
-
oADO.Open(sConnection);//<--- this line gives the error
-
var rsSheet=oADO.Execute(sSQL);
-
if(!rsSheet.EOF){
-
aVals=rsSheet.GetRows();
-
aVals=aVals.toArray();
-
var colCount=rsSheet.Fields.count;
-
}
-
rsSheet.Close();
-
rsSheet=null;
-
oADO.Close();
-
oADO=null;
-
-
if(!aVals){
-
Response.Write("The worksheet is blank.");
-
Response.End();
-
}else{
-
Response.Write("<table>");
-
for(y=0;y<aVals.length;y+=colCount){
-
Response.Write("<tr>");
-
for(x=0;x<colCount;x++){
-
Response.Write("<td>"+aVals[x+y]+"</td>");
-
}
-
Response.Write("</tr>");
-
}
-
Response.Write("</table>");
-
}
-
BTW, when trying the folowing connection string the code works fine ...
Code:
-
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