By using the below example you read the excel sheet using vbscript, you can use the same code in QTP also.
Set objWorkbook = objExcel.Workbooks.Open _
("C:\Scripts\New_Book.xls")
intRow = 2
Do Until 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
("C:\Scripts\New_Book.xls")
intRow = 2
Do Until 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