Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import Excel data from Quality Center into QTP Script
#1
Not Solved
Hi,

I need help very very urgently,

How can I import excel from quality center folder path to QTP script?

I have written

datatable.Import ("[QualityCenter] Subject\FLIGHT_08\Data\Sample.xls") but i am getting error message path does not exist?

I want the above to be success using script but not thru tool provided settings?

Please Help me ASAP.....?

Thanks,
Ram
Reply
#2
Not Solved
First of all , please refrain from using the words like "very very urgently" , "ASAP". All members here are doing a voluntary activity of helping others, these words do nothing but to annoy them no end.

Now to your query,

This method requires the full path of your QC server and will not work with just the simplified path.

Try using DataTable.Import "//Path of your Quality Center server/...../Sample.xls"
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Not Solved
Hi

I tried importing excel data through this process but it gives me an error

The DataTable.Import (file) operation failed. Invalid file.

Line (6): "DataTable.Import "\\[QualityCenter] Subject\Automation Scripts\...\file.xls"".

PLease correct me if I have done some mistake in syntax...
if syntax is right then please tell me how to do that......
Reply
#4
Not Solved
Try using QCUtil object..
Something like below...
Code:
Set tdc = QCUtil.QCConnection
set tm = tdc.TreeManager
set root = tm.TreeRoot("Subject")
set folder = root.FindChildNode("Your folder name")
Set fact = folder.Attachments
and so on...
Reply
#5
Not Solved
Hi,

I am trying yours answer again and again, but with no result Sad

Is this syntax correct?

datatable.Import ("//mercurytd.com:8003/qcbin/Subject/TestFolder/Book2.xls")

Does the path need to be to MQC Test Plan > Test Folder > Test attachement > name of attachement???
Or to module Test Lab???


Thank you
J.
Reply
#6
Not Solved
I have the same problem, could anybody help me? Sad

Thanks in advance.
Reply
#7
Not Solved
Hi,

Use the below code it might help u.
Make changes for QC test paln folder structure.

Code:
Function ImportDataSheet(strsheet)
   Dim sheet_name
   sheet_name=DataTable.LocalSheet.Name
   Call Import_ressources("Subject\97_RTT Resources","TestData","DataSheet.xls",strsheet,sheet_name)
End Function

Function Import_ressources (parent_folder, proj_name, src_file, src_sheet, dest_sheet)

Import_ressources = false

Set objTreeManager = QCUtil.TDConnection.TreeManager
Set projNode = objTreeManager.NodeByPath(parent_folder)

'  projNode.Count = nombre de REPs trouvés
For i = 1 to projNode.Count
  '  Le sous_dossier a été trouvé
  If instr (1, projNode.Child(i).Name,  proj_name) > 0 Then
   Set projNode = projNode.Child(i)
   Exit For
  End If
     Next
wait(2)
' Recherche du fichier paramètres (attaché)  
Set res = projNode.Attachments.NewList("")
For Each attach In res
  If Not Instr(1 , attach.FileName , src_file) = 0 Then
   attach.Load True, "C:\"
            datatable.AddSheet (dest_sheet )
   ' REM : 1 --> première feuille dans le fichier XLS
    DataTable.ImportSheet attach.FileName, src_sheet, dest_sheet
   'DataTable.ImportSheet attach.FileName, 1, dest_sheet
   Import_ressources = true
  End If
Next
wait(2)
End Function



Regards,
Sankalp
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,155 07-10-2017, 04:20 PM
Last Post: rajeevk7
  dtLocalSheet empty even though excel file contains data cantorre 2 2,194 05-10-2017, 12:47 PM
Last Post: vidhi
  Reading data from excel sheet serenediva 1 8,734 03-03-2017, 10:07 AM
Last Post: vinod123
  How import final calculated values by cell formula from Excel not the formula itself. qtped 1 4,696 01-17-2017, 04:05 PM
Last Post: sagar.raythatha
  Attaching QTP result to Quality Center vikas_dhir 5 19,643 01-06-2017, 11:55 AM
Last Post: Swetha_Bayya

Forum Jump:


Users browsing this thread: 1 Guest(s)