Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
importing excel file and run on all iterations
#1
Solved: 8 Years, 3 Months, 2 Weeks ago
hi,
a) i want to know how to import data from external excel sheet and run the flight application with single login name in global sheet and create order for 3 different users i.e for 3 different user names from excel sheet.
b)Then same for 3 different login users.

In 1st case i am not able to run for all 3 rows for single login but it is running for 1st row 3times ...So i want to know how to run for all iterations?
Reply
#2
Solved: 8 Years, 3 Months, 2 Weeks ago
i think u r not incrementing the counter of row number. Try this.. but dont increment column value

suppose col1 contains user name and col2 contains password
-------------------------------------------
Code:
dim sExcelObj
dim sWorkBook
dim sWorkSheets
dim sValue

set sExcelObj = CreateObject("Excel.Application")
sExcelObj.Visible = true
set sWorkBook = sExcelObj.Workbooks.Open ("path of file")
set sWorkSheets = sWorkBook.ActiveWorkbook.worksheets ("sheetname")

username = sWorkSheets.cells(row,col1).value
password= sWorkSheets.cells(row,col2).value
row=row+1

You can also import your excel into QTP and then iterate. also you need to do some setting in options. Check the file attached.
----------------


Code:
datatable.importsheet "c:\excelfile.xls", "sheet1"

To get a value form excel file..
Code:
Empno = datatable.value("empno", "sheet1")

To run the script for all the iterations..
Code:
For i = 1 to datatable.getsheet("sheet1").getrowcount
msgbox datatable.value("empno", "sheet1")
Next


Attached Files Image(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to export the output value of a webedit object to a new excel file. mounika6677 1 1,531 04-14-2019, 05:18 PM
Last Post: mounika6677
  Invalid file error importing xls file Makhado 0 1,421 10-04-2018, 04:33 PM
Last Post: Makhado
  Access not saved excel file randhirsinghskhn 0 1,038 09-04-2018, 07:26 AM
Last Post: randhirsinghskhn
  Repeat iterations Until New Value Is Seen in Column1 shayk1985 1 1,745 07-05-2018, 05:52 PM
Last Post: Ankur
  UFT Datatable iterations Studymode 2 3,799 12-12-2017, 11:10 PM
Last Post: Studymode

Forum Jump:


Users browsing this thread: 1 Guest(s)