Read excel using qtp descriptive programing

Answers were Sorted based on User's Feedback



Read excel using qtp descriptive programing..

Answer / bindu

'Create Excel Object
Set excel=createobject("excel.application")
'Make it Visible
excel.Visible=True
'Open the Excel File
Set workbook=excel.Workbooks.Open("D:\excel.xls")
'Get the Control on Specific Sheet
Set worksheet1=workbook.Worksheets.Item("Sheet1")
'get rows count
a1=worksheet1.usedrange.rows.count
'get columns count
a2=worksheet1.usedrange.columns.count
msgbox a1
msgbox a2
For i=1 to a1
celltext=" "
For j=1 to a2
celltext=worksheet1.cells(i,j)
msgbox celltext
Next
Next
workbook1.close
set excel=nothing

Is This Answer Correct ?    3 Yes 0 No

Read excel using qtp descriptive programing..

Answer / debashish

‘read excel sheet
dim xl,wb,ws
set xl=createobject("excel.application")
set wb=xl.workbooks.open("H:\asis excel.xlsx")
xl.DisplayAlerts=False
set ws=wb.worksheets("sheet1")
r=ws.usedrange.rows.count
c=ws.usedrange.columns.count
For i=1 to r
v=""
For j=1 to c
v=v &" "& ws.cells(i,j)
Next
msgbox v
'msgbox"-----------------------"
Next
'For i = 1 to r
' For j =1 to c
'msgbox ws.cells(i,j)

' Next
'next
wb.save
wb.close
set xl=nothing

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

Basically why we need testing?

14 Answers  


Hi, i want download attached files in test plan area from QC to local drive in my system using QTP script. Please help me

3 Answers  


Need one Urgent help please,for ex: first time i created Local reposory and convert that local to shared Rep and save in some where(by using Export local objetcs), unfortunately that saved repository is missed, now i want same repository,but iam not able to export the same repository second time?? i need that Repository only how to get???

2 Answers   TCS,


Hi Friends, while playing the recorded test i am getting this error "Cannot identify the object "q" (of class WebEdit). Verify that this object's properties match an object currently displayed in your application." error is coming in this line of code "Line (2): "Browser("Google").Page("Google").WebEdit("q").Set "airtel broadband"". " .... please tell me how to overcome this problem. need help asap... Thanx in advance

3 Answers  


we add library file used in test via settings or through "ExecuteFile" command. when we implement framework do we make common library file and load the same for all the test cases execution?

0 Answers  






How many types of actions are there in quicktest professional (qtp)?

0 Answers  


what is the diffrence between script and Language ? (Chandana)

6 Answers   Cognizant, Wipro,


Waht is diff between SystemUtil.Run and invokeapplication

5 Answers  


I am testing a Website thelancet and create a description for searching "health" in search edit box.But my description failed on last two lines.Can anybody solve this

1 Answers  


How many lines of code in each script of QTP?

0 Answers  


What is the difference between Global and Local Data Sheets?

1 Answers  


During execution, how can we capture the data from the pop- up, ie. when any popup comes with some numbers written on it, then how can we capture the value/number that is coming on the pop-up and save in the dynamic file/or other file, even when the run is going on.

2 Answers   Wipro,


Categories