Skip to main content

GetCount

Returns the rows or columns count.

Syntax

expression.GetCount();

expression - A variable that represents a ApiRange class.

Parameters

This method doesn't have any parameters.

Returns

number

Example

This example shows how to get the cells count in the range.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A1").SetValue("1");
oWorksheet.GetRange("B1").SetValue("2");
oWorksheet.GetRange("C1").SetValue("3");
var nCount = oWorksheet.GetRange("A1:C1").GetCount();
oWorksheet.GetRange("A4").SetValue("Count: ");
oWorksheet.GetRange("B4").SetValue(nCount);