When importing an excel file that has several columns each
with different number of rows into QTP's Global datatable,
how can you count the number of rows in a particular column?

Answers were Sorted based on User's Feedback



When importing an excel file that has several columns each with different number of rows into QTP&..

Answer / pushkar1206

datatable.ImportSheet "C:UserspushkarDesktop123.xls","Sheet1","Action1"
rw=datatable.GetSheet("Action1").GetRowCount
For i=1 to rw
a=datatable.GetSheet("Action1").GetParameter("_11").ValueByRow(i)
c=len(a)
If c>0 Then
b=b+1
End If
Next
msgbox b

Is This Answer Correct ?    1 Yes 0 No

When importing an excel file that has several columns each with different number of rows into QTP&..

Answer / satya

Here is a piece of code where we are importing the exl
sheet DS and getting row count then using them in For Loop.


datatable.AddSheet ("DS")
Datatable.ImportSheet "C:\satya.xls","DS","DS"
RowCount = Datatable.GetSheet("DS").GetRowCount
For RowCount = 0 to RowCount -1
Datatable.GetSheet("DS").SetCurrentrow(RowCount +1)
val = Datatable.RawValue("username","DS")
msgbox val
Next

hope it clear u...!

Is This Answer Correct ?    2 Yes 2 No

When importing an excel file that has several columns each with different number of rows into QTP&..

Answer / srinu

setShet = Datatable.Getsheet("Sheet Name")
rowcon=shet.getparameter("colum Name").getrowcount
msgbox rowcon

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More VB Script Interview Questions

In html file what is an ideal position to include vbscript?

0 Answers  


Hi, Anybody could you Please tell me How to write the script for Checking whether given number is Prime Number or not..Thanks in Advance

6 Answers   Amazon,


if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.

0 Answers  


how to answer "TELL ME ABOUT UR SELF" as exp.person. whr to start and whr to stop. can anyone tel me

0 Answers  


Write a VB Script to count blank Lines in a notepad

2 Answers   IBM,






What are the disadvantages of vbscript?

0 Answers  


why variable name should not exceed 255 characters?

0 Answers  


write a vb script to find simple interest using functions

1 Answers  


Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?

0 Answers  


How to insert snapshot during manual scripting in QTP?

1 Answers  


Like OPTION EXPLICIT statement what are the other statements used in vbscript and their usage. Please post me all the statements please.

0 Answers   Accenture,


Diff between web table ,datatable and data base (QTP)

2 Answers   TCS,


Categories