Search here for all the info you want in this Blog

Read an Excel Spreadsheet using vbscript

By using the below example you read the excel sheet using vbscript, you can use the same code in QTP also.




Set
 objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
    ("C:\Scripts\New_Book.xls")

intRow = 2

DoUntil objExcel.Cells(intRow,1).Value = ""
    Wscript.Echo"First Name: " & objExcel.Cells(intRow, 1).Value
    Wscript.Echo"Last Name: " & objExcel.Cells(intRow, 2).Value
    Wscript.Echo"Address: " & objExcel.Cells(intRow, 3).Value
    Wscript.Echo"Phone: " & objExcel.Cells(intRow, 4).Value
    intRow = intRow + 1
Loop

objExcel.Quit

No comments:

Post a Comment