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

How cookies can be tested in QTP?

2 Answers   Deloitte, TCS,


How to Set the Global Sync Timeouts in QTP?

2 Answers  


Plz explain about object propeties in object identification? means.. explain about 1. mandatory properties.2. assestive properties 3. ordinal properties.

3 Answers   TCS,


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  


What is iteration? How it is related to Test Results in QTP?

2 Answers  


How to create runtime property for an object?

0 Answers  


Can we do Load Testing with QTP?

4 Answers  


Hi Guys, here I am posting one question. Wen u r working with Notepad. If it is not responding in the middle of TEst...what u will do.

7 Answers  


How do you know the location Id of an object if you know its index id?

0 Answers  


What are the option you can use to synchronize your test?

2 Answers  


IF application is a Java-based application means 2 0r 3 tier application. How the script will be in QTP. pls kindly give some sample script.

5 Answers   Wipro,


what is ODC and GDC?

0 Answers   Patni,


Categories