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

which checkpoint we use to validate yahoo login screen window after login with ur id and password in qtp

8 Answers   Covansys,


what is the use of automation objective model?where is used? plz tell me

2 Answers  


how to upload an excel sheet to quality center?

1 Answers  


Is it possible to map an image as standard Object or u've to treat as virtual? how to map an Dynamic image into standard object?

1 Answers  


What ate the Technologies supported by QTP?

0 Answers  






why should we give deliver good quality software?

0 Answers  


Suppose Object name was changed in the application in the second build.I have just modified the name in the Object repository as changes in the Application. Is it possible to accure changes in the script accordingly? If so Suppose I am calling the script through function, Will the changes affect in the script(which is in the function)automatically? If not affected, tell me the solution,How to handle this. How should I change the object property name while using functions

4 Answers   Livetek,


How to test menu options using qtp

2 Answers  


draw the qtp frame work?

0 Answers  


How to merge the two object repositories

3 Answers   Wipro,


How do we count the no of mails in Yahoo Inbox for a specified week?

0 Answers  


Through array we can execute the testcase how ? give me example

0 Answers   TCS,


Categories