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

how to get no.of non empty rows in a excel sheet through vb-script

2 Answers   HP,


How will you send values to a cell in a webtable using QTP?

2 Answers  


Please help me by providing the License key for QTP 9.2, at guru_aarya@yahoo.co.in Best Regards Gururaj.B

0 Answers  


what is the difference between seat and concerent licenses.

3 Answers   AppLabs, TCS,


Associated files in QTP?

1 Answers  






In Webtable New rows getting added, we have select the name as Sandeep ,If name column is sandeep then need to check the checkbox ,we don't know the rows and columns ,Can anyone please tell me the answer.

3 Answers   Broadridge, Cigniti Technologies, HCL,


Please anybody can tell the where can i get the information about pharma and bank testing, i put the pharma&bank projects in my resume, so i dont know what to tell about them, so where can i get the information and what we test for these, i need domain information, what r the screen we test?

0 Answers  


for example u can take ebay or plifcart online shoping web application--------- write acode in vbscript in qtp---- search box and write (iphone6)and click on go button then opened diff prise iphones in next page but u can select 30,000 to 90,000 list pls write code? 

2 Answers   FFASVA, Genpact, Wipro,


wht type of User defined functions or Java Releated functions do we write in VB scripting

0 Answers   Wipro,


Reverse string without mid or streverse function.

1 Answers   Deloitte,


Hi can anybody send me the QTP material, To my email ID: nuve1284@gmail.com ?

0 Answers  


how can u find the syntax errors or other script errors in your test during the execution of your QTP Test - (i.e., not after the execution/test run finished, but before finishing the test run)

2 Answers   HCL,


Categories