How to get data from excel sheet to the script? write the
script.
Answers were Sorted based on User's Feedback
Answer / jyothi
Set a= Createobject("Excel.Application
Set b = a.workbooks.open"D:\Keyword\Test Data\data.xls"
Set c = b.Worksheets("sheet name")
Then retrieve the data like
set x= c.cells(1,1).value
| Is This Answer Correct ? | 8 Yes | 2 No |
Answer / he he eheyyy he ... baa
Excel.Workbook workBook = app.Workbooks.Open(Path, 0,
true,
5,
"",
"",
true,
Excel.XlPlatform.xlWindows,
"\t",
false,
false,
0,
true,
1,
0);
//// Get The Active Worksheet Using Sheet Name Or
Active Sheet
Excel.Worksheet workSheet =
(Excel.Worksheet)workBook.ActiveSheet;
try
{
string[] email = new string[40];
for (int i = 1; i < email.Length; i++)
{
if (i <= 40 )
{
if
(((Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2
!= null)
{
rowIndex = 2 + index;
string emailid =
((Excel.Range)workSheet.Cells[rowIndex,
colIndex1]).Value2.ToString();
//string[] email = new string[9];
//string lastName =
((Excel.Range)workSheet.Cells[rowIndex,colIndex2]).Value2.ToString();
//string emailid =
((Excel.Range)workSheet.Cells[rowIndex,
colIndex3]).Value2.ToString();
Class1.SendMail(emailid);
//Response.Write(emailid);
index++;
}
}
}
}
catch (Exception ex)
{
app.Quit();
Response.Write(ex.Message);
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / srinath
close the excel sheet which you want to open in QTP
first row will always be column name which will be used in
script
datatable.import("c:\path,,,\xlsheetname.xls")
a=datatable.value("jksdfj")
| Is This Answer Correct ? | 3 Yes | 4 No |
DataTable.Import("xlsheetname.xls")
For i=1 to DataTable.GetRowCount step 1
DataTable.SetCurrentRow(i)
........................................
.......................................
Stmts
......................................
...................................
DataTable.SetNextRow
Next
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / murali k m
datatable.Importsheet "D:\Keyword\Test Data\data.xls"
| Is This Answer Correct ? | 0 Yes | 4 No |
What is the use of sendkeys and what are send keys
Explain about the Test Fusion Report of QTP ?
Will QTP Support Visual Foxpro Applications? If yes please tell me whether I need to install any additional addins for that?
Could anyone please tell me one situation where you have used recovery scenarion in real time with an example?
What is the syntax for how to call one script from another?
Suppose there are 100 links in a web page and the number of links will be changing dynamically from time to time. I need code such that every time i had to click on the last link of the web page.
Client is able to provide budget..he want you to choose the automation tool for the web application? which one you will select ? QTP or Selenium ? what are the reasons?
hi this is srinivasa(from blr) i complited my B.tech(e.c.e) in 2007 im searching job in s/w testing but idont have freshers resume for s/w testing please send some s/w testing resume for me(fresfers resumes only) advns thnks you
I have written some scripts in QTP by using older version, but I want to run them in latest version. Is there any process to do that.If so can anyone explain me?
can we use QTP for load testing instead of load runner?
What is the diffrence bettween QTP 9.0 and QTP 9.1?
Can we set a timeout for the msgbox.I want the msgbox to disappear after 2 seconds during the script execution without clicking on the OK button manually.