Read excel files with ado.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I'm trying to open an excel file with ado. Can I use a SELECT statement? The script below
says it can't find the sheet1 table (in the line with OPEN). That is the name of the first
sheet in the file.
I want to find a value in column A, retrieve the content of that row and modify a couple
of cells.
With a different script I found that ado cannot find the adox.catalog table object in the
excel file because that property is unsupported for this provider.
It would be fine even if I could read single cells. The search would take more time, but
could be done.
If there is no way to use ADO, I can open it with excel.application (I know how to do it
this way, but I don't want to start the whole application every time for a quick search).
Thank you.

Set oRecordset = createobject("ADODB.Recordset")
Set oConnection = createobject("ADODB.Connection")
oConnection.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=list.xls;Extended
properties=Excel 8.0"
oRecordset.ActiveConnection = oConnection
oRecordset.CursorType=1 : oRecordset.LockType=3
SQL = "SELECT * FROM sheet1"
oRecordset.Open SQL, oConnection

--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
.



Relevant Pages

  • RE: AD-Users to contacts
    ... I've written a script that takes in input the data from a "well formatted" ... excel file that show the result of each creation. ... - Uppercase letters will be substituted whit lowercase letters ... users in formation from the old directory, the first part of the job). ...
    (microsoft.public.windows.server.scripting)
  • Re: AD-Users to contacts
    ... Hi SubnetJO! ... > I've written a script that takes in input the data from a "well formatted" ... > excel file that show the result of each creation. ... after you ave filled the input file with data (dumping ...
    (microsoft.public.windows.server.scripting)
  • Re: very rookie VBScript ADO RDS Binding question
    ... Because that you are a Rookie, you can leave ADO quick behind you. ... The idea of the script is ... > Some of my connection info is as follows: ... > ' Create an ADO recordset object ...
    (microsoft.public.dotnet.framework.adonet)
  • help in scripting excel2k3
    ... I had this script that would open an Excel File, loop through it then close the file. ... It worked when I had ExcelXP installed on my machine, but now I can't get the script to work with Excel2k3. ... WScript.Echo "No input file provided. ... Set objExcel = WScript.CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: msDS-KeyVersionNumber AD property
    ... a script to identify a number of key user attributes to help ... strDN = objRecordSet.Fields.value ... Or add the attribute to the comma delimited list of values returned by ADO. ...
    (microsoft.public.scripting.vbscript)