Reputation: 65
I want to capture only 1 column from excel file and put all the data in a Test box like
AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE FFFFFF
and click on the save button, this data AAA,BBB etc. is in a excel sheet column I want to import it in a text box of a web page and process this text, I tried a for loop, however the data from excel is entered on same line and getting deleted when new data comes in
Following is the Code segment I am trying to write, any help appreciated:
Thanks
Browser("Web Browser").Page("Some Web page").Link("Relavent Link").Click
Datatable.Import "C:\QTP\CLIMS\ABOT\Default.xls"
RowCount = Datatable.GetSheet("Global").GetRowCount
CurrentRow = DataTable.GetSheet("Global").GetCurrentRow
runcontrols()
Function runcontrols ()
For runctrl = 1 To RowCount
Browser("Web Browser").Page("Some Web page").WebEdit("Running Link").SetDataTable("RunControlsA", dtGlobalSheet)
DataTable.SetNextRow
Next
End Function
My excel file has 3 columns and I am trying to import from one column
Upvotes: 0
Views: 8425
Reputation: 1
Excel Handling is essential part of QTP automation there are 4 steps to implement the same. Refer to the below post for more explnation.
http://softwaretestingperfection.blogspot.com/2013/09/excel-handling-in-qtp.html
Upvotes: 0
Reputation: 159
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Example.xls")
Set currentWorkSheet = objExcel.ActiveWorkbook.Worksheets(1)
intColCount = 5
For ctr = 1 To intColCount
temp = temp + " " + currentWorkSheet.Cells(1,ctr).Value
Next
If I am reading your situation correctly, you have a spreadsheet as in the image and are trying to read the content of column A. In that case, the above code will come in handy. Let us know if you need any further help.
Upvotes: 1