How to Import data from a ".xls" file to Data table during
Runtime.
Answers were Sorted based on User's Feedback
Answer / rajshri
datatable.Import("file path")
datatable.Importsheet("file path",sheetid)
| Is This Answer Correct ? | 18 Yes | 0 No |
Answer / deeps
Hi,
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 ? | 14 Yes | 3 No |
Answer / chinna
Hi,
Datatable.Importsheet("Path of the sheet",Source sheetid,
Destination sheetid)
Ex.Datatable.importsheet("C:\Book1.xls",1,1)
z=datatable.getrowcount
For i = 1 to z
datatable.setcurrentrow(i)
A=datatable.value(1,1)
b=datatable.value(2,1)
c=a+b
datatable(3,1)=c
Next
msgbox c
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / masack
If you want import all the sheets of the workbook during
runtime datatable.
Dim array_shtname()
Set xls = createobject("Excel.Application")
xls.visible = true
Set xlsop = xls.workbooks.open ("excel\path")
shtcount = xlsop.worksheets.count
ReDim preserve array_shtname(shtcount)
For sh = 1 to shtcount
array_shtname(sh-1) = xlsop.worksheets(sh).name
Next
xls.quit
Data_Sheet_Count = datatable.GetSheetCount
For i = 1 to shtcount
Datatable.AddSheet Cstr(array_shtname(i -1))
datatable.ImportSheet "excel\path",i,cint(Data_Sheet_Count)
+i
Next
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / sanhosh
The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table.
DataTable.ImportSheet "C:
ame.xls" ,1 ,"name"
How ever in runtime data table iam unable to get the sheet pls help me.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / varun bisaria
Datatable.Import "...XLS file name..."
DataTable.ImportSheet(FileName, SheetSource, SheetDest)
DataTable.ImportSheet "C:
ame.xls" ,1 ,"name"
| Is This Answer Correct ? | 0 Yes | 0 No |
Dim Shet1' Add a new sheet
Data table.Addsheet "shet1"
'datatable.importsheet "file name","Source
sheet","destination sheet"
datatable.importsheet "file name","sheet 1","shet1"
'now we can check the run time data table
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / kirankumar.y
varaiable=data table.value("perameter name",dt global
sheet/dt local sheet)
if it is wrong please correct me
| Is This Answer Correct ? | 1 Yes | 4 No |
I have a list box which contains duplicate values e.g. A,A,A,B,B,B,C,C,C.Now write a code in qtp to test the list box . Scenario #1 : I have to check whether any values are there? Scenario #2 : If duplicate values are there,then how many time it is getting duplicated? Svenario #3 : how can I test presence of items in list box ommiting duplicate values?
Hello friends..... On which areas of an application we can not test with QTP
0 Answers Thatavarti Technologies,
I would like to directly import XL file and work on that XL file directly in QTp script in that XL sheet need to allocate workbench,XL sheet and generate two bar graphs automatically how to do that? plz let me know any answers?
in how many ways we can write the user defined functions one way i know that i.e storing it in .vbs another way i does not know my friend said that .qtf or something but start with q letter can any buddy knows about this
How do i relate the checkbox properties with webelement when checkbox properties are changing on every login to the application
How to do the Mouse Operations in QTP. How to aacess an Image in a web application to save it on my desktop. To my Knwoledge that can be done by mouse right click on the Image and selecting 'Save the Image'option. Or Is there any alternate way to do this..
How many types of recording facility are available in QTP?
Explain how you can find length of array in qtp?
object types is used for what?
how can we handle exceptional handling in qtp
How to call the userdefined functions to script? If i am stored 'add()' function in Library functions folder. i want to cal that function in my script.
Hi, I Install QTP 9.2 in windows Vista. but it is not supporting IE. it is supporting only windows based application. could I change any setting in Vista for supporting IE.. ?? thanks in advance...