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

in process of project exaplnation the defects are says frequently r not?

1 Answers  


What is the descriptive programming?

0 Answers  


Deal All, Recently i face one interview question in one company. str="test12@#3456" In This i want to print like special character and numeric ,word in one script please tell me how to write the code for this Thanks Balaji

1 Answers  


w is fragmentation and paging

1 Answers   MBT,


Can I do Game testing with QTP tool

1 Answers   Google,






What is the difference between Recover Scenario(screen) and on Error Resume Next(code)

4 Answers  


Hi, I am using OutputCheckPoint and I am storing the value in the data table. The stored value for column:bedroom:"Bed:4" The another value for column:bathroom:"Bath:2 Full,1 Partial" I need only the no 4 from the first column. I need only the no 2,1 from the second column. I used split array,but it also show array(0) has the value"bed:4" ..... Even though I highlight only 4,It is seleting the full value "bed 4".How can I get only the nos Thank you Uma

0 Answers  


What is throw object?

1 Answers  


What is the latest version of qtp?

0 Answers  


Explain about Table and DB Checkpoints?

1 Answers   Crea,


What is test object?

0 Answers  


I used the below code to open QTP through VBscript?But i can unable to Invoke QTP...PLZ help me with the correct code to invoke QTP through VBS with description of the code aswell. Dim qtApp 'As QuickTest.Application 'Declare the Application object variable Dim qtTest 'As QuickTest.Test 'Declare a Test object variable Dim qtResultsOpt 'Declare a Run Results Options object variable Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object qtApp.Launch 'Start QuickTest qtApp.Visible = False 'Make the QuickTest application visible qtApp.Open "C:\form", True 'Open the test in read-only mode 'set run settings for the test Set qtTest = qtApp.Test qtTest.Run 'Run the test 'WScript.StdOut.Write "Status is: " & qtTest.LastRunResults.Status 'Check the results of the test run qtTest.Close 'Close the test qtApp.quit 'Close QuickTest Pro Set qtResultsOpt = Nothing 'Release the Run Results Options object Set qtTest = Nothing 'Release the Test object Set qtApp = Nothing 'Release the Application object

0 Answers   ADITI,


Categories