How to get data from a particular row and a particular column from Excel Sheet in QTP?
Check This Post For Script To Get Cell Value of Particular Row and Column From Datatable in QTP.
QTP Script to get particular cell value from ExcelSheet in the specified row.
Below script is for retrieving 2rd row,2rd column cell value from already existing excelsheet in D drive.
In excelsheet we have values as shown below
A B C
1 aa xx
2 bb yy
3 cc zz
Script to get value "bb" from ExcelSheet is
Set a=createobject("Excel.application")
Set b=a.workbooks.open("D:\es.xls")
Set c=b.worksheets("Sheet1")
d=c.cells(2,2).value
msgbox d
b.close
Similarly to retrieve 3rd row,1column value(3)replace d=c.cells(2,2).value with
d=c.cells(3,1).value in the above script.
SQL Queries Collection
Movie Songs Lyrics
Other QTP Scripts
VBScript to Check Whether Particular File Exists or Not.
Check this Post for Datatable Methods.
Excel Sheet Creation and Writing Data Into It
Data Driven Using Excel Sheet
Data Driven Using Notepad
VBScript to Get Cell Value of Particular Row and Column From ExcelSheet
Subscribe to:
Post Comments (Atom)
4 comments:
In one of aplication, I have drop down box for each Date, Month and Year to select a Travel
start date.
After selecting theses fields when we go to the next page the selected date appear as
mm/dd/yyyy format on next page as text element.
In QTP i want to verify if the date appearing on the next page is same as we select on first page.
Also if parameterize the dates of first page i want to validated the next page dates.
Can you please help me.
Hi Sudhir,
Hope this helps you.
first get date value into text_value variable from second page.
text_value=Browser().Page().WebEdit().getROProperty("text")
This is for 1st page
get selected values from dropdown box(month,date and year )
a=browser().page().webdropdownmonth().GetSelection
b=browser().page().webdropdownday().GetSelection
c=browser().page().webdropdownyear().GetSelection
Compare both dates.If dates are same u get msg as "both dates are same".
for example:
a=1
b=27
c=2009
d= a& "/" &b&"/"&c
If strcomp(d,text_value)=0 then
msgbox "both dates are same"
else
msgbox"dates are different"
end if
In this scenario I know which row I am using within excel. Let's say row 5.
Now in my excel there are 11 columns. Some rows have data in all columns and some do not. So for row 5 there maybe 6 columns of data.
I want to pull the data starting in Column 2 and keep getting the data until I reach a column with a blank cell. I will also need the number of columns with valid data per that row as well.
Any ideas how I can do this?
I was thinking about using a For Loop and maybe an Array.
The data I am pulling are names of Tabs on a web page. I want to pull the data and verify those tabs and names are really on the web page.
Thanks,
Steve
Email: slang46188 "at" aol.com
Hi,
I need to check if a value in a particular cell in excel is "1" then I want QTP script to return PASS. In case value is NOT "1" then script should return FAIL.
Can someone help me in this.
Thanks a lot in advance.
Regards,
Abby
Post a Comment