SEMrush

QTP - How to Read data from Excel Sheet explained with examples

How do you read data from an excel sheet , when you are working with QTP?

Set the File you want to use and then Get the Cell Value of that file

ExcelUtil.SetFile(WorkBookPath, WorkSheet).GetCellValue(Row, Column)  


Examples
'Example 1
ExcelUtil.SetFile "C:\Example.xls", "Sheet1"

'Example 2:  Reading value directly from a file
sCellValue = ExcelUtil.SetFile("C:\Example1.xls", "Sheet1").GetCellValue(1, 1)

'Example 2:  Reading value from another file
sCellValue = ExcelUtil.SetFile("C:\Example2.xls", "Sheet1").GetCellValue(1, 1)






Links to useful posts: