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
Print the Prime numbers in below format only up to 20(Need commas also) 1,2,3,5,7,9,11,13,17,19
Hi, I am using OutputCheckPoint and I am storing the value in the data table. The stored value for column:bedroom:"Bed:4" The another value for column:bathroom:"Bath:2 Full,1 Partial" I need only the no 4 from the first column. I need only the no 2,1 from the second column. I used split array,but it also show array(0) has the value"bed:4" ..... Even though I highlight only 4,It is seleting the full value "bed 4".How can I get only the nos Thank you Uma
What is the architecture of your project? Can any one answer for this question plz........
An action has both shared and local OR associated with it and both have the same object in them. In the test which one will be considered?
Define Environment Variable in UFT and its uses?
What are the trigger events in qtp?
What is the difference between analog and low level recording?
How to execute a winrunner script in quicktest professional?
how to test use the quality control .how to verify the image verification
what is the difference between rational rose and QTP? WHICH TOOL IS BETTER TO LEARN? PLEASE SEND ME AT sana_50218@yahoo.com sandeep@epuratech.com
hi all can anyone explain how to write the code for finding the mandatory columns in table which are having (red*) (red Astrik)
How are actions and functions different in QTP?
When to use shared and local object repository?
can u please explain what is the exact difference between qtp8.2 and 9.0
Hi Friends... By using QTP , can we test .net products...and that product supports different languages.. thanx in advance..