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 XML file architecture ?
what r the send key commands in QTP why they r used
What is the keyword view and expert view in qtp?
Hi Friends ,I want to Know name of the Site for the QTP Help and the Best Book through that I can start the QTP Practice here also whare can I download the QTP Users Guide I search I was Unable .
want to learn real time automation project(QTP)?
Hi, My Application in Microsoft Dynamic Navision, is it compitibale with QTP? if yes then let me know...and also let me know is there any other automation tool availabe to automate Microsoft Dynamic Navision. Thanks Sandip. +91-9714177088
How you calling actions in qtp?
hi i have one doubt is there any companies are taking correspandence courses plz leme know urjent
In QTP whether is it possible to call a function from one action to another action?
What is post recovery scenario?
What is the DIFF Between PROJECT AND PRODUCT?When Company will need Product?
How we can use the database checkpoint on a java web based application in which the database connectivity is done using JDBC->Pure Java type (in this type there is no need to create a DSN). At present in QTP we can fetch database values using checkpoint only through DSN. Is there any programming for this if we don't have DSN (ODBC)