How to Import data from a ".xls" file to Data table

during Runtime.



How to Import data from a ".xls" file to Data table during Runtime...

Answer / sreeprasad

DataTable.Import("path of the file")

DataTable.ImportSheet("filepath","sheetsource","sheetDest")

Sheetsource:index or name of the sheet in the file which u

want to import. index begins vth 1.

SheetDest: index or name of the sheet in the datatable

which u want to replace vth Sheetsource.Index begins vth 1.

ex:

Datatable.importsheet("c:\name.xls",1,"name")

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More QTP Interview Questions

difference Between Call Run action and copy of action?

3 Answers   Quest,


How the exception handling can be done using QTP

6 Answers  


Difference between action & Reusable action?

0 Answers  


I am facing an issue of object identification with the dropdown element of DHTML grid. When I tried to recognize these different dropdown objects, QTP identifies only one object for all the dropdowns. Hence, selection of different data from different dropdowns list is an issue. To overcome this problem, i have used Descriptive Programming technique by creating different object descriptions which have all the other properties same but differ only in one property i.e. ‘X’ location of the element on the screen. Hence, i have created distinct object descriptions that would allow us to select values in different dropdowns. The code is given below. But still I am unable to identify distinct dropdown objects. ‘Object Description for Dropdown Cell Status Set objCellStatus = Description.Create objCellStatus("micclass").value = "WebList" objCellStatus("name").value = "select" objCellStatus("x").value = 219 ------ ‘X’ Axis value for cell status drop down ‘Object Description for Dropdown Sub Segment Set objSubSegment = Description.Create objSubSegment("micclass").value = "WebList" objSubSegment("name").value = "select" objSubSegment("x").value = "319" ------ ‘X’ Axis value for sub segment drop down Please help... This is specific to DTML grid(Drop down object)

0 Answers  


how to parameterise a test with data base table or excel sheet?

1 Answers   FCG,


I am using descriptive programming for my project.when QTP deosn't identity or recognize a object by record and playback method,is it possible to make QTP identify that object using descriptive programming? Note: The object doesn't have unique properties and same properties used in Record and playback are only available, no extra properties are defined.

3 Answers  


How can I pass values from one action to another in QTP ?

8 Answers   Ordain Solutions,


Where to use Property Let, Property Get, Property Set in UFT

0 Answers  


Hi, I have 2 dropdown listboxes called region and city/area. It needs to select one region(Santa Clara) and one city/Area (Sunnyvale).So I put this in the for loop and I am storing the Items in the variable called itemname. The regions value will get changed,so I used reg expression for this regions. This is my code Browser("MLSListings.com").Page("MLSListings.com").Link("» County/Area").Click Browser("MLSListings.com").Page("MLSListings.com").WebList ("regions").Check CheckPoint("regions") ListSize=Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetTOProperty("items count") For i = 1 To ListSize-1 Itemname =Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetItem(i+1) Browser("MLSListings.com").Page("MLSListings.com").WebList ("regions").Select Itemname ................. If I run the script,I am getting the following error, Cannot identify the specified item of the regions object. Confirm that the specified item is included in the object's item collection. Any Help? Thank you, Uma

0 Answers  


how can i pass a "cript"as a parameter in to a function

0 Answers  


Describe the differences between functions and actions in UFT?

0 Answers  


How to Practice QTP Scripts?

1 Answers  


Categories