Retrieve Particular Cell Data

How to retrieve particular cell data in datatable?

Questions by kishore12345

Showing Answers 1 - 12 of 12 Answers

calvin_29

  • Sep 23rd, 2010
 

First you should select the required cell and use object spy to know rows nos. and col nos. in the selected area then use below in QTP editor
set oReqVal= browser().page().webtable().getcelldata(rows ,cols)
print oReqVal

  Was this answer useful?  Yes

Satyesha

  • Mar 29th, 2011
 

Hi there are two approaches to do so-
1.If you want to retrieve data from any external exl sheet.
'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=excel.Worksheets.Item("Sheet1")  
  
 ' Display the Values  
 Msgbox  worksheet1.cells(1,1).value   
'this can be iterate with for loop by taking the rows count of exl sheet i.e. cells(i,j).
   
 'Close Work Book    
 workbook.Close    
     
 'Quit from Excel Application    
 excel.Quit  
  
2. In case of QTP integrated data table use-
DataTable().getsheet().Getparameter("col name").


  Was this answer useful?  Yes

functions CellData(int rowno,int columnno)
{
Set excel=createobject("excel.application")
excel.Visible=True
Set workbook=excel.Workbooks.Open("D:excel.xls")
Set worksheet1=excel.Worksheets.Item("Sheet1")
getdata=
worksheet1.cells(rowno, columnno).value
workbook.Close
excel.Quit
return getdata
}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions