How to export(copy) the entire webtable from the webpage
into Excelsheet? using Vb scripting

Answers were Sorted based on User's Feedback



How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / vikas sachdeva

For this first u need to add a webtable in the object
repository and use this line

dim xl
set xl=createobject("Excel.Application")
xl.workbooks.open "c:/book1.xls"
set nsheet=xl.sheets.item(1)
row=Browser("browser").page("page").webtable
("table").getroproperty("rows")
cols=Browser("browser").page("page").webtable
("table").getroproperty("cols")
for i=0 to row-1
for j=0 to col-1
val=Browser("browser").page("page").webtable
("table").getcelldata(i,j)
nsheet.cells(i,j)=val
next
next

Is This Answer Correct ?    18 Yes 3 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / rentalavdml

Can u be clear in the question you mean copy the contents
of the webtable into excel or you need the whole webtable
object into excel

Is This Answer Correct ?    11 Yes 0 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / raj

Please try this code. It will save the whole WebTable
content in the form of excel sheet.

Environment("Peportpath")="C:\Result.xls"
a=Browser("Google").Page("Google").WebTable
("index:=0").GetROProperty("outerhtml")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WriteFile = FSO.CreateTextFile( Environment
("Peportpath"), True)
writeFile.writeLine(a)
writeFile.close

Is This Answer Correct ?    9 Yes 1 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / yogesh

Well,

I think you can copy all webtable (the table that is
displayed on your test application) values into runtime
table or datatable using two simple for loop and then
export the runtime table to excel file with the command as
mentioned by Shridhar.

I havent written any such script as of now. but will post
it here when I write it.

Thanks,
Yogi.

Is This Answer Correct ?    1 Yes 1 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / hnayaka

Whole webtalbe content into the datatable. Including all
its columns and rows

Is This Answer Correct ?    3 Yes 5 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / gururaj

Sridhar thanks for the response. My question is I wanted to
use the runtime webtable clomuns and rows as input to the
another application during run time.

I have one application when we run with some inputs will
get the results as a webtable format in the web
application. I wanted to use those inputs as a input to
the another application during runtime.

Please let me know if your not clear with my question.

Thanks in advance.

Is This Answer Correct ?    1 Yes 3 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / jay prakash

As QTP Supports Data Corelation very well.. So the output
from one obj/table can be used as input to another
obj/table. As Yogi explained... you capture your values in
the runtime data table and use it as the input to ur
requirement. Simple Data Driven testing strategy will help
you.

Is This Answer Correct ?    0 Yes 3 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / sridhar

Use DataTable.export('path of the x.ls') method and write
all the contents into excel file. Hope this helps else letm
e know.

Sridhar.

Is This Answer Correct ?    1 Yes 5 No

How to export(copy) the entire webtable from the webpage into Excelsheet? using Vb scripting..

Answer / raj

Thanks for answering to my question. Thanks a lot

Is This Answer Correct ?    0 Yes 6 No

Post New Answer

More QTP Interview Questions

what is Synchronization point in QTP?Can anybody give a perfect example on it Thanks in advance

5 Answers  


I am getting an error "failed to open the XML checkpoint result viewer" in result window,after clicking on "View XML checkpoint results".Someone suggest me settings,if any...

0 Answers  


Discuss quicktest professional environment?

0 Answers  


How we can test a Frame in a web page?

1 Answers   eMids,


I created 3 actions in test suppose I want to run action 1 in single time, action 2 is 4 time what I do?

0 Answers  






I added 5 edit box objects in OR.i run the script and the first edit box successfully executed.But on next day when i executed same script for second edit box,it gives an error "object not Found". But when i used Highlight in app. object already in OR.So how i will handel this type of error. Hi please inform me the write answer.Its urgent.

1 Answers   TCS,


1. What is the difference between Keyword and function in the keyword driven framework? 2. How do you associate Keywords to the script ?

0 Answers  


How i can change shared repository to per test repository in qtp

1 Answers  


Can we use smart identification in Keyword Driven approach? If yes , How we can use. Please Explain?

1 Answers  


What are the types of object repositories? Which one is you using?

0 Answers  


How will u integrate oracel with QTP?

2 Answers   Microsoft,


What are accessibility check point and xml check point?

5 Answers   IBM,


Categories