Skip to content
 

How do you get data from the text file into the QTP data table?

this example explains you how one can extract data from a text file into qtp.

const toRead = 1
row=1

set objFSO = CreateObject(“scripting.filesystemobject”)
set objFile = objFSO.OpenTextFile(“c:\test2.txt”, toRead)

dim filename()
i=0

Do until objFile.atEndofStream
Redim Preserve filename(i)
filename(i) = objfile.readline
i+i+1
loop

objFile.close ‘closes this file

For Each strline in filename
myarray = split(strline, “”, -1, 1)
for each sline in myarray
datatable(“A”,dtglobalsheet)=sline
row=row+1
next
next

datatable.exportsheet “c:\test3.xls”,1
exit run

how to bring data from a text file into qtp data table how to bring data from a textfile into qtp datatable qtp test results as txt file

Leave a Reply