Micro Focus QTP (UFT) Forums
unable to import excel data in to data table - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: unable to import excel data in to data table (/Thread-unable-to-import-excel-data-in-to-data-table)



unable to import excel data in to data table - RGummadidala - 02-08-2011

Hi All,

I'm also struggling to import an excel file to Datatable. I have an excel by name Sample.xls and my script is as below
Code:
Dim qt
Set qt = createobject("QuickTest.Application")
qt.Launch
qt.Visible=True
DataTable.ImportSheet "C:/Users/Desktop/Sample.xls",1,"Global"

I wrote this in expert view of QTP and ran it. When I run it, I'm seeing the Global sheet of DataTable getting populated (I see the values copied to cell quickly), but at the end of the run, there are no values in the DataTable. I also see 5 iterations of the execution, in the HP results view, where as I ran it only once.

Can somebody throw some light on this ?


RE: unable to import excel data in to data table - DinakarVadapalli - 02-08-2011

u can find the data only during run time...
once execution is done...u can find the data in run time data table of results file


RE: unable to import excel data in to data table - manishbhalshankar - 02-08-2011

Hi RGummadidala,

When you import excel in datatable, it is displayed in the global sheet but it is actually imported in the run time datatable. Check the run time datatable in the results, you will see all the values. But as soon as the run is completed and the script stops execution, the values will disappear from qtp datatable.

There might be 5 rows of data you are improting thats why your script performed 5 iterations eventhough you ran the script only once. Check the Test Settings -- Run tab. Option selected might be "Run on all rows".


RE: unable to import excel data in to data table - RGummadidala - 02-09-2011

Hi,
Thanks for your advice,my problem got sloved.


Regards,
Rgummadidala.


RE: unable to import excel data in to data table - sriraj - 06-22-2011

Hi,
I am having similar kind of code but values are not loading to runtime table and script is failing.
Note:I don't have MS office installed in my server where QTP installed.
Please help on this.

Code:
Code:
globalpath = DataTable.Value("Global_Path","MainAction")
    DataTable.ImportSheet globalpath, "Global","Global"

Thanks,
Sree