Micro Focus QTP (UFT) Forums
"How to Export results into EXCEL" - 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 Interview Questions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Interview-Questions)
+--- Thread: "How to Export results into EXCEL" (/Thread-How-to-Export-results-into-EXCEL)



"How to Export results into EXCEL" - suresz449 - 12-16-2011

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


RE: "How to Export results into EXCEL" - sshukla12 - 12-16-2011

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


RE: "How to Export results into EXCEL" - Ankesh - 12-16-2011

Sures,

You can use

Code:
Datatable.Export "<DesiredResultExcelFileName>


Regards,
Ankesh


RE: "How to Export results into EXCEL" - shivu.impu - 02-14-2012

you can directly write executed result into excel sheet by using excel operation by using creation of excel object



RE: "How to Export results into EXCEL" - alencooperr - 02-16-2012

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..


RE: "How to Export results into EXCEL" - mrajeshtnl - 02-21-2012

Code:
Datatable.Export "<path>



RE: "How to Export results into EXCEL" - SebOfBorg - 06-27-2012

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



RE: "How to Export results into EXCEL" - Shridevi.Salagare - 07-03-2012

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.


RE: "How to Export results into EXCEL" - sidhuqtp - 07-14-2015

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