Exforsys

Online Training

Import EXCEL Data into QTP Global Data Table

This is a discussion on Import EXCEL Data into QTP Global Data Table within the Software Testing forums, part of the Testing category; Hi, Wanted a Help. Doubt No.1 ---------- Any one who knows about export and import of data from QTP Gloabl ...


Go Back   Exforsys > Testing > Software Testing

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-21-2006, 09:02 AM
Junior Member
 
Join Date: Aug 2006
Posts: 4
venkata krishnamurthy t is on a distinguished road
Import EXCEL Data into QTP Global Data Table

Hi,

Wanted a Help.

Doubt No.1
----------
Any one who knows about export and import of data from QTP Gloabl Data Table to Office Excel and Office Excel to QTP Global Data Table.

at 1st I have placed the data in QTP Global Data Table.
Later I am exported the data to the Office Excel Sheet.

I am not able to retrive the data from the Office Excel Sheet.

Doubt No.2
-----------

Instead of placing the data in the QTP Global Data Table. I wanted to Store the data directly in office Excel Sheet and call the data back into QTP while I am Running the Script.

Can any one help me in this 2 issues.
__________________

Thanks & Regards
Krishnamurthy Tatavarthy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-21-2006, 09:24 AM
Senior Member
 
Join Date: Mar 2005
Posts: 910
techguru is on a distinguished road
try this..

You can use Action and Test parameters to parameterize the hard coded value of Excel sheet path, or even you can go for Environment variables.
Using Test and Action parameter:

Follow following procedure
Go to Test Settings-> Parameters-> define the input parameters (for ex: path)

As Test parameter can't be used directly in Test script, goto Correspoding Action an right click and go to Action properties and define Action parameter to use.(for ex: path1)

then goto Action Call Properties-> and set value for defined action parameter
as Test parameter(in value column for that parameter click on the '<>' to set value and set Test parameter as parameter type and set "path" variable to Action parameter(path1)

and use same action parameter in the datatable.import sheet statement
datatable.importsheet path1 When we run the Test we can give the path of Excel sheet in "Run dialog box->Paramters" .
Using of Environment variable define an environment varibale in Test->settings->Environment parameters

Select parameter type as "Userdefined" from list box and define the parameter and use directly in datatable.importsheet statement. Here we need to give value of path before executing the script.

Ref: QTP : I m setting the excel sheet path in QTP for importing as : datatable.importsheet "C:Qtpabc.xls" but
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2007, 06:43 AM
Junior Member
 
Join Date: Apr 2007
Posts: 1
mmahima2002 is on a distinguished road
Import and Export Sheet

Use the following statements for importing

DataTable.ImportSheet "..\..\TestData\Input.xls",1,dtGlobalSheet
DataTable.ExportSheet "..\..\Results\Output.xls","Global"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2007, 03:51 PM
Junior Member
 
Join Date: Aug 2006
Posts: 1
krishnabr is on a distinguished road
Simple Answer

just follow the steps:-
1) Record script in QTP
2) Save the script
3) close QTP
4) open saved script location in your local drive.(You can see a folder with your actuall script name)
5) open the folder
6) you can find 'Default.xls'
7) enter the data what ever you want in this excel file.
Do remember QTP will treat that the first row as column names.
8) save the excel and close.
9) open QTP application. Press 'Ctrl+O'
and open the script you just saved.
10) you can see the data what ever you have saved in 'Default.xls' sheet in Data table.


The other simple way is just right click on datatable and select File>Import From File To import data from office excel.


Cheers.
__________________
Yours,
Krishna
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-01-2007, 09:00 AM
bharathp's Avatar
Member
 
Join Date: May 2006
Location: Banglore,India
Posts: 85
bharathp is on a distinguished road
Send a message via AIM to bharathp
thse things are ok
any other methods and procedures
__________________
Bharath Kumar.P
Test Engineer
Banglore, India
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-30-2007, 08:16 AM
deeps
 
Join Date: Nov 2007
Location: Bangalore,India
Posts: 1
aj.deepika is on a distinguished road
Ans for Doubt No.1

for importing a file:

DataTable.Import "filename.txt"

(you have to write the path name also for eg:
DataTable.Import "C:\Documents and
Settings\mercury\Desktop\fly.txt")

for Exporting a file:

Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")

Set MyFile = fso.CreateTextFile("fileName.txt",True)

(Eg:Set MyFile = fso.CreateTextFile("C:\Documents and Settings\mercury\Desktop\flight.txt",True)

MyFile.WriteLine("Fly_From"&" "&"Fly_To"&" "&"Order_No"&" "&" Flight" )


C1=DataTable.Value(1,1)&" "
C2=DataTable.Value(2,1)&" "
C3=DataTable.Value(3,1)&" "
c4=DataTable.Value(4,1)
B=C1&C2&C3&c4
MyFile.WriteLine(B)

This is just an example
Note: To get the contents in diff column in Exel sheet give tab.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-30-2007, 08:45 AM
kalyansantosh's Avatar
Member
 
Join Date: Feb 2007
Location: Hyderabad
Posts: 91
kalyansantosh is on a distinguished road
Send a message via Yahoo to kalyansantosh
help

is there any openings in ur company
__________________
Kalyansantosh
Sr QA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 12-09-2007, 11:59 PM
Junior Member
 
Join Date: Jun 2006
Posts: 1
sharanjadhav is on a distinguished road
the syntax to import sheets from excel to data table is...........
DataTable.ImportSheet "location of .xls file","sheet in .xls file","sheet in data table"

Ex: DataTable.ImportSheet "C:\gettingstarted.xls","sheet1","action1"

similarly u can import other required sheets into data table as well.......
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
difference between Data Warehouse and Online Analytical Processing techguru Data Warehousing 1 04-10-2006 12:25 PM
Use XML to Import Data Matrix_2006 XML 0 02-18-2006 03:07 AM
Saving a data in excel sheet....Using QTP oracleraju Testing Tutorials 3 09-02-2005 06:20 AM
hierarchail & network kisshug Oracle Tutorials 2 05-01-2005 05:17 PM
can we write data back to data table? mangalsachin2002 Testing Tutorials 1 03-21-2005 03:35 PM


All times are GMT -4. The time now is 08:45 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.