Sign in to follow this  
Followers 0
jrahman

Counting number of rows having data in Excel sheet

4 posts in this topic

I have an AUtoIT3 script which reads 10 cells of data in column 2 from an Excel sheet and put in a Array.

The code is as below:

;Read the data start from row 2, column 2, 10 cells downward direction and save in an array
Local $aArray1 = _ExcelReadArray($oExcel, 2, 2, 10, 1)

If the sheet is populated with more or less data, I have to change the number of cells (in the above case it is 10) in the script.

Is there any AutoIT3 function to count the number of rows in Excel those have data before putting them into the Array, in that case, I could replace cell number parameter '10' by a variable (as below):

Local $aArray1 = _ExcelReadArray($oExcel, 2, 2, $cellCount, 1)

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

google VBA Excel usedcells:

ActiveSheet.UsedRange.Cells.Count

ActiveSheet.UsedRange.Rows.Count

ActiveSheet.UsedRange.Columns.Count

simple example:

Dim $atest[5]=[123,1234,12345,123456,123567]
$oExcel = _ExcelBookNew ()
_ExcelWriteArray ( $oExcel, 1, 1,$atest, 1  )
MsgBox ( 4096, "count rows", $oExcel.ActiveSheet.UsedRange.Rows.Count )
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

_ExcelReadSheetToArray() ought to work for you.

There's a version that is drastically faster than the production version here:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0