Create an Excel file and pass the values from Flat File? (for ex:data1.txt,data2.txt )
Answer Posted / prashant puranik
'To transfer the data from flat file to excel. I have used a logic as Flatfile to datatable to excel
Dim fso,myfile,i,row
i=1,row=0
Set fso=Createobject("Scripting.filesystemobject")
Set myfile=fso.OpenTextFile("G:QTP Examplesqtpexamplefile2.txt",1,True)
Datatable.AddSheet("Puranik")
Datatable.GetSheet("Puranik").AddParameter "Prashant" ," "
Do While myfile.AtEndOfStream <> true
row=row+1
Datatable.GetSheet("Puranik").SetCurrentRow(row)
Datatable.Value("Prashant","Puranik")=myfile.ReadLine
Loop
Datatable.Export("G:QTP Examplesqtpexample_file1.xls")
Set myfile=nothing
Set fso=nothing
'Similary i have created i logic to transfer the data from excel to notepad file
Dim fso,i,myfile
Datatable.AddSheet("mysheet")
Datatable.ImportSheet "G:QTP Examplesqtpexample_file2.xls","Sheet1","mysheet"
row=Datatable.GetSheet("mysheet").GetRowCount
Set fso=Createobject("Scripting.filesystemobject")
Set myfile=fso.OpenTextFile("G:QTP Examplesqtpexamplefile3.txt",2,True)
For i=1 to row
Datatable.GetSheet("mysheet").SetCurrentRow(i)
myfile.WriteLine(Datatable.Value("Anuj","mysheet"))
Next
Set myfile=nothing
Set fso=nothing
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
how to prepared for first for the first interview?
How to get the format of a webedit class in qtp. How can i know that particular webedit accept what type of format like "mm/dd/yyyy" or "$" or Alphanumeric
write a script for allinterview-submit Question first we've to select Choose Category,second select Sub- Category(Which is comes in to runtime)third select Question Type.for that give some descriptive and vb script
why you have standardized functions? plzzz guys with real time exp. do answer
What is the difference between Keyword Driven test and Data Driven test?
what are the challenges you have faced while testing web based application using the automation tools ?
How can we extract data like "Details","Result","Time" from the 'Run Error' result generated in QTP after run time errors are generated during a run & import the details etc...into excel sheet
How to capture all the data of a webtable, weblist and combolist using QTP?
I am sathish , i want to test the Application of JIL.org ,Mobile Emulator ,by using QTP10.0. I am trying to do testing on that Application , but Child Objects are not identified by the QTP. Please can any one help me
Can launch two instances of qtp on the same machine?
Can anyone pls tell me in realtime (descriptive programming) how will the properties of the object be given to the test team. R they given in an excel sheet and is the same sheet also given to the development team and by whom is this given? Thanks a lot.
There are 10 rows in the datatable. How can we fetch 2 rows and then skip 3rd row. After that, pick 4th & 5th row and skip 6th row. Please share code
i am a begnner so am learning Error handling :tried using Recovery manager didnt work i want to be able to handle errors , e.g. if while running the test the folwoing does not show up then how can i use the If then else and goto next step in the test, as in many scenarios it does not show up Browser("The Shopping Channel -").Page("The Shopping Channel -_8").Image("easy pay").Click
For example you are checking bit map check point before coming to the results. How can you say it is passed? Or failed? Anyways?
How will we compare the texts in the two word files using QTP writing the script in Descriptive Programming. Thanks