Importing xl sheet to datatable not working

443 views
Skip to first unread message

code2a...@gmail.com

unread,
May 25, 2013, 8:47:13 AM5/25/13
to mercu...@googlegroups.com
Saying a general error ...
Sent from BlackBerry® on Airtel

Ganesh muralidharan

unread,
May 25, 2013, 9:46:46 AM5/25/13
to mercuryqtp
are you importing a .xls file or a .xlsx file?


On Sat, May 25, 2013 at 7:47 AM, <code2a...@gmail.com> wrote:
Saying a general error ...
Sent from BlackBerry® on Airtel

--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Regards,


Ganesh Muralidharan
'God Never Forgets'

code2a...@gmail.com

unread,
May 25, 2013, 8:54:04 AM5/25/13
to mercu...@googlegroups.com
Working on qtp 11. Initially I tried xlsx . It said invalid file.

I have a. xls file name student containing a sheet student.

The sheet have three cols with data.

Qtp script have an action name student .

Datatable.getsheet("student").addparameter "stdname",""
Datatable.getsheet("student").addparameter "stdage",""

Datatable.getsheet("student").addparameter "stdaddress",""

Datatable.importsheet "path of the file", "student", "student"

Error - a general error occured while importing sheet student from file : "file path "
Sent from BlackBerry® on Airtel

From: Ganesh muralidharan <mgkg...@gmail.com>
Date: Sat, 25 May 2013 08:46:46 -0500
Subject: Re: Importing xl sheet to datatable not working

Ganesh muralidharan

unread,
May 25, 2013, 10:13:51 AM5/25/13
to mercuryqtp
this seems to be a file issue

code2a...@gmail.com

unread,
May 25, 2013, 10:01:35 AM5/25/13
to mercu...@googlegroups.com
Datatable.import "file"

Does it import all the sheets to datatable. Which datasheet should it refer. Global or local. Do you need to have the col name in the datatable same as in xls file. Can you please explain in detail.
Sent from BlackBerry® on Airtel

From: Ganesh muralidharan <mgkg...@gmail.com>
Date: Sat, 25 May 2013 09:13:51 -0500

Ganesh muralidharan

unread,
May 25, 2013, 11:03:42 AM5/25/13
to mercuryqtp
We dont need to add parameters before importing so try running after commenting Datatable.getsheet("student").addparameter "stdname","" stmts

code2a...@gmail.com

unread,
May 25, 2013, 10:12:09 AM5/25/13
to mercu...@googlegroups.com
Ok. I will try. But in qtp doc it says that the col names must match the parameter names. Bit confused. Also does the sheet name need to be same as sheet name in xls. If not then does qtp import in separate sheet keeping global sheet and local sheet. if you can share your thoughts ...

Sent from BlackBerry® on Airtel

From: Ganesh muralidharan <mgkg...@gmail.com>
Date: Sat, 25 May 2013 10:03:42 -0500

Ganesh muralidharan

unread,
May 25, 2013, 11:16:51 AM5/25/13
to mercuryqtp
Syntax

DataTable.ImportSheet(FileName, SheetSource, SheetDest)

Argument

Type

Description

FileName
String
The full path of the Excel table from which you want to import a sheet. It can be a file system or Quality Center path.
SheetSource
Variant
The name or index of the sheet in the file that you want to import. Index values begin with 1.
SheetDest
Variant
The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1.

Example

The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table.

DataTable.ImportSheet "C:\name.xls" ,1 ,"name"

Notes:

The column headings in the sheet you import must match the Data Table parameter names in the action for which the sheet is being imported. Otherwise, your test or component may fail.

The sheet you import automatically takes the name of the sheet it replaces. 

code2a...@gmail.com

unread,
May 25, 2013, 10:59:42 AM5/25/13
to mercu...@googlegroups.com
Ok. In that case we need to addparamater names in sheet to match the col names . So we need datatable.addparameter statements. What abt the datatable.import ?
Sent from BlackBerry® on Airtel

From: Ganesh muralidharan <mgkg...@gmail.com>
Date: Sat, 25 May 2013 10:16:51 -0500

Akhalesh Yadav

unread,
May 28, 2013, 3:21:47 AM5/28/13
to mercu...@googlegroups.com
Hi,
Please make sure that your file should be closed before execute the qtp code.


Thanks...
Akhalesh


On Sat, May 25, 2013 at 6:17 PM, <code2a...@gmail.com> wrote:
Saying a general error ...
Sent from BlackBerry® on Airtel

--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Akhalesh yadav
+919555717928
+919310680659
Reply all
Reply to author
Forward
0 new messages