Option Explicit Dim adoCSVConnection, adoCSVRecordSet, strPathToTextfile Dim strCSVFile, k ' Specify path to CSV file. strPathToTextFile = "c:\Scripts\" ' Specify CSV file name. strCSVFile = "DomainUsers.csv" ' Open connection to the CSV file. Set adoCSVConnection = CreateObject("ADODB.Connection") Set adoCSVRecordSet = CreateObject("ADODB.Recordset") ' Open CSV file with header line. adoCSVConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & strPathtoTextFile & ";" & _ "Extended Properties=""text;HDR=NO;FMT=Delimited""" adoCSVRecordset.Open "SELECT * FROM " & strCSVFile, adoCSVConnection ' Read the CSV file. Do Until adoCSVRecordset.EOF ' Display all fields. For k = 0 To adoCSVRecordset.Fields.Count - 1 Wscript.Echo adoCSVRecordset.Fields(k).Value Next adoCSVRecordset.MoveNext Loop ' Clean up. adoCSVRecordset.Close adoCSVConnection.Close
Tuesday, 5 December 2017
Vbscript: Reading CSV file using ADODB
Subscribe to:
Post Comments (Atom)
-
Description Waits until the specified object property achieves the specified value or exceeds the specified timeout ...
-
Option Explicit Dim adoCSVConnection, adoCSVRecordSet, strPathToTextfile Dim strCSVFile, k ' Specify path to CSV file. strPathToTextF...
-
Below Code works if the WebElement has supports Drag and Drop Function. If Object does not support Drag and Drop , Mercury Device Replay ...
No comments:
Post a Comment