Micro Focus QTP (UFT) Forums
export values to the excel sheet - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: export values to the excel sheet (/Thread-export-values-to-the-excel-sheet)



export values to the excel sheet - rjkmr.aiht - 04-26-2012

this is my code

Code:
Set oWebtable = Description.Create()
oWebtable("micclass").value = "Webtable"
oWebtable("column name").value = "Type;Trade Show;Media Type;Email"

Set oChildObjects = Browser("title:=Campaign Framework:.*").Page("title:=Campaign Framework:.*").webtable("innertext:=TypeTrade ShowMedia TypeEmailPartneryesCampaign SeriesBig DataSFDC Campaign.*","html tag:=table")
a=ochildobjects.GetROProperty("rows")
b=ochildobjects.GetROProperty("cols")
c=ochildobjects.GetCellData(3,2)
msgbox c




can any one please help me to export the values "c" to excel sheet

please find the attachment here and help me out


RE: export values to the excel sheet - falvi - 04-26-2012

please try to read the contents of this page, and tell if it helps you.

http://www.rlmueller.net/Programs/XLRead.txt
or try this simpler one:

Code:
Set objXL = CreateObject("Excel.Application")
Set objWB = objXL.WorkBooks.Open("C:\Scripts\test1.xls")
Set objWS = objXL.ActiveWorkBook.WorkSheets("test1")
objWS.cells(i,j).value = YourVariable // i,j defines the cell you wish to put the data in.

objWB.Close
objXL.Quit



RE: export values to the excel sheet - Ankesh - 04-26-2012

Hey just add one column to your global sheet and give some name.

Write the vale to the datatable and expot using the below code
Code:
Datatable.value("<Your Column Name>",dtGlobalSheet)=c
Datatable.Export "<Full File Path>"


Regards,
Ankesh


RE: export values to the excel sheet - rjkmr.aiht - 05-02-2012

hi thank u for reply


caan u please help out for this


Code:
set camptable=browser("title:=Campaign Framework:.*").page("title:=Campaign Framework: Home ~ salesforce.com - Unlimited Edition").webtable("column names:=Campaign Name;Status;Start Date","html tag:=TABLE")
c=camptable.GetROProperty("rows")
'msgbox c
    datatable.SetCurrentRow(1)
For i=2 to c
    a=camptable.getcelldata(i,1)
    msgbox a
datatable.Value("id","Global")=a
datatable.setnextrow
Next


here i want to put the values in next cell it not happening its oly showing the value in first cell


Regards,
raj


RE: export values to the excel sheet - Ankesh - 05-03-2012

Use the below code...

Code:
set camptable=browser("title:=Campaign Framework:.*").page("title:=Campaign Framework: Home ~ salesforce.com - Unlimited Edition").webtable("column names:=Campaign Name;Status;Start Date","html tag:=TABLE")
c=camptable.GetROProperty("rows")
'msgbox c
intCurrentRow=1
datatable.GetSheet("Global").SetCurrentRow intCurrentRow
For i=2 to c
a=camptable.getcelldata(i,1)
msgbox a
datatable.Value("id","Global")=a
intCurrentRow=intCurrentRow+1
datatable.GetSheet("Global").SetCurrentRow intCurrentRow
Next

Let me know if this doen't help.

Regards,
Ankesh



RE: export values to the excel sheet - rjkmr.aiht - 05-03-2012

thanku for the reply i tried and get the code


Code:
set camptable=browser("title:=Campaign Framework:.*").page("title:=Campaign Framework: Home ~ salesforce.com - Unlimited Edition").webtable("column names:=Campaign Name;Status;Start Date","html tag:=TABLE")
c=camptable.GetROProperty("rows")
For i=2 to c
a=camptable.getcelldata(i,1)
row=DataTable.GetSheet("Global").getCurrentRow
datatable.getsheet("Global").SetCurrentRow(row)
datatable.Value("id","Global")=a
datatable.getsheet("Global").SetCurrentRow(row+1)
datatable.Export "c:\test11.xls"
next



RE: export values to the excel sheet - Ankesh - 05-03-2012

Glad that it worked for you. Big Grin


RE: export values to the excel sheet - rjkmr.aiht - 05-04-2012

thank u its working fine

please help for the last post for REgular expression