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

In a shared Object Repository in QTP if some object is changed how can the other script which is using the same object can be known

6 Answers   iGate,


CAN WE USE 'BVA' AND 'ECP' IN AUTOMATION?

3 Answers   Polaris,


How can I replace all the text from the QTP script with some other text.

1 Answers   Livetek,


what is difference between application testing and product testing?

5 Answers   IBM,


why we use check points , In qtp we use the any check points , what r they , when and why

1 Answers   Polaris,






what is ODC and GDC?

0 Answers   Patni,


HOW TO COUNT NUMBER OF ITEMS PRESENT IN WEB LIST

8 Answers  


what is test scheduling?

1 Answers  


What is the difference between QTP 8.2 and QTP 9.2 ?

4 Answers   IBM, Infotech,


Object repositories types, which and when to use?

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  


Hi Friends,will any body tell to Me for which Auomation Tool their is great Requirement inht eMarket Eithr the QTP or WINRUNNER and for what reason and how long it is going to remain and wat the Scope for the automation Testing In the Future Please tll to Me In Details Ok .

2 Answers  


Categories