Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"How to Export results into EXCEL"
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Folks,

After completion of successful run we are getting the results so, how we can export that results into excel sheet.In QTP we have any methods to export results into Execl sheet.

I am using QTP v10.0
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
QTP results to Excel

There are 2 functions

1)
Code:
initOutExcel(sTablePath)

Description : This function is to initialize a particular Excel Where you want to update the Results of the QTP Tests.

2)
Code:
WriteResults(sTablePath,sStatus,sFunctionality,sDescription)

Description : This function appends the Result of a Test to the end of the existing results.

You can modify the below functions to suite your requitrement.

CODE:

Code:
Function initOutExcel(sTablePath)

Datatable.addSheet "Results"

Datatable.importSheet sTablePath, "Results","Results"

iParamCount = Datatable.getSheet("Results").getParameterCount

if iParamCount = 0 Then

Datatable.getSheet("Results").addParameter "S.No",""

Datatable.getSheet("Results").addParameter "Status",""

Datatable.getSheet("Results").addParameter "Functionality",""

Datatable.getSheet("Results").addParameter "Description",""

End If

Datatable.ExportSheet sTablePath,"Results"

End Function

Function WriteResults(sTablePath,sStatus,sFunctionality,sDescription)

Datatable.addSheet "Results"

Datatable.importSheet sTablePath, "Results","Results"

iRowCount = Datatable.getSheet("Results").getRowCount

Datatable.getSheet("Results").setCurrentRow(iRowCount+1)

Datatable("S.No","Results") = iRowCount+1

Datatable("Status","Results") = sStatus

Datatable("Description","Results") = sDescription

Datatable("Functionality","Results") = sFunctionality

Datatable.ExportSheet sTablePath,"Results"

End Function


Regards,
Sankalp
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Sures,

You can use

Code:
Datatable.Export "<DesiredResultExcelFileName>


Regards,
Ankesh
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
you can directly write executed result into excel sheet by using excel operation by using creation of excel object
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
According to me, Export is the great technique for you use expect to copy from Access to Excel usually. When you perform that operation, You also can save the details for any kind of future use and also re-schedule the export to run automatically at set intervals..
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Code:
Datatable.Export "<path>
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Hello,

I have to export a datatable to an Excel File.

I already use the DataTable.ExportSheet "PathOfMyFile", "NameOfMySheet"
Now I'd like to improve this...

I have 2 tests with the same name so 2 iterations.
I have set 2 sheets names BLABLA_1 and BLABLA_2

The Datatable in the Action is named BLABLA
The import is done like this
Datatable.ImportSheet "PathOfMyFile", "NameOfMySheet" & Index, "BLABLA"

-> Index is a manual parameter set in QC.

My question is ... how can I export this ?
I have tried to write
Datatable.ExportSheet "PathOfMyFile", "NameOfMySheet" & index
but the action is named "NameOfMySheet" without index... so error

I have also tried
Datatable.ExportSheet "PathOfMyFile", "NameOfMySheet" but here, excel create a new sheet ..

Could somebody help me ?

(Sorry for my english... I'm french).
Thanks in advance.a
Reply
#8
Solved: 11 Years, 3 Months, 3 Weeks ago
You can do one thing..
1.Create a sheet in DataTable for each iteration.
2.Then check teh iteration number ..it its last iteration ..export it using DataTable.Export.

Let me know if this helps.
Reply
#9
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Sankalp,

I did used the code given by you above, But It's going into loop for every
otherwise, its doing fine

How to get out of loop, I need to write only once at the end of each iteration ONLY

Reply ASAP

Thankx
Sidhu
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)