The xls contain data. how to get number of columns form
the sheet?

Answers were Sorted based on User's Feedback



The xls contain data. how to get number of columns form the sheet?..

Answer / uday

strFilePath="D:\EmpDetails.xls"
Dim fileSysObj
Set xlObj=createobject("Excel.application")
Set xlWorkBookObj=xlObj.workbooks.open(strFilePath)
Set xlWorkSheetObj=xlWorkBookObj.worksheets(1)

intRowCount=xlWorkSheetObj.UsedRange.rows.count 'intRowCount
=xlWorkSheetObj.rows.count - it returns the number of rown
in an Excel sheet

intColCount=xlWorkSheetObj.UsedRange.columns.count
' intColCount=xlWorkSheetObj.columns.count - it returns the
number of columns in an Excel sheet

msgbox "No. of rows used "&intRowCount&" and No. of columns
used. "&intColCount

xlWorkBookObj.close
xlObj.application.quit

Set xlObj=nothing
Set xlWorkBookObj=nothing
Set xlWorkSheetObj=nothing

http://hpsqtp.blogspot.com/2009/04/how-to-find-number-of-
rows-and-columns.html

Is This Answer Correct ?    5 Yes 0 No

The xls contain data. how to get number of columns form the sheet?..

Answer / ur

To get the column count use.
allCols = DataTable.GlobalSheet.GetParameterCount
Msgbox allCols

Is This Answer Correct ?    5 Yes 2 No

The xls contain data. how to get number of columns form the sheet?..

Answer / basha

for outside xls sheet we have follow below
datatable.addsheet("Sheetname")
datatable.importsheet("sheetname",sheetid,"sheetpath")
rowcount=datatable.getsheet("sheetname").getrowcount
msgbox(rowcount)

for globalsheet
rowcount=datatabe("GlobalSheet").getrowcount
msgbox (rowcount)

for actionsheet

rowcount=datatable("LocalSheet").getrowcount
msgbox (rowcount)

Is This Answer Correct ?    2 Yes 4 No

The xls contain data. how to get number of columns form the sheet?..

Answer / basha

for global sheet

rowcount=datatable.globalsheet.getrowcount
msgbox (rowcount)


for action sheet

rowcount=datatable.localsheet.getrowcount
msgbox (rowcount)

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More QTP Interview Questions

I am having major problems with some DB Table Checkpoints I add to my script. I 35 web based applications recorded and each has DB Table Checkpoints insert but only 1 script isn't recognizing the DB Table Checkpoints for some reason. I've checked the DB connections and the info in the Library Functions and still only this one script out of 35 doesn't recognize the DB Table Checkpoints. Can someone please help me figure out why only this one script out of 35 that's hitting the same database is having a problem.

0 Answers  


How to Analyze the Checpoint results by Table and DB Checkpoints?

1 Answers  


What is the use of Regular expression?

5 Answers  


Can any one explain me what is the procedure to connect the remote desk by using QTP 9.2 ?

0 Answers   IGI,


Why you have to add the specific add in in QTP? My answer is to recognize the specific objects we have to add the add-in in QTP...but he asked again after adding addin how qtp recognize the objects successfully? what is there in the add-in ?

1 Answers   CTS,






How to create a run time propertyfor an object?

3 Answers   IBM,


What are the differences between qtp and winrunner?

0 Answers  


Write a command for setvalue function in a webedit

3 Answers   Wipro,


QTP 10.0 is not identifying web objects for IE 8.it is identifying like winObject.I installed HP patch QTPWEB_00037.Still getting issue

1 Answers  


What is the differnce between action & script

2 Answers   Lehman Brothers,


What is the differnce between action & script

1 Answers  


What is OUTPUT VALUE ? PLZ Explain With Example?

5 Answers  


Categories