# GetColCount

Use the GetColCount method to get the number of columns in the displayed page. Learn its syntax and parameters in documentation.

## Content

Gets the number of columns in the displayed page.

## Syntax

[JavaScript]

```javascript
var ret = FpSpread1.GetColCount();
```

## Parameters

None

## Return Type

Integer, number of columns

## Remarks

This method returns the number of columns in the displayed spreadsheet on the client. For a count of the rows, refer to [GetRowCount](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allmeths/CSSR-GetRowCount).

## Example

This is a sample that uses the method to count the columns in order to create a grand total of all the subtotals from each column and put the result in the first column. On the client side, the script that contains the method would look like this:

```javascript
<script type="text/javascript">
   function doCalc() {
     var colcount = FpSpread1.GetColCount();
     var total = 0;
     for (var i=1; i<colcount-1; i++) {
       var subtotal = parseFloat(FpSpread1.GetValue( 10,i ));
       total += subtotal;
     }
     if (!isNaN(total))
       FpSpread1.SetValue(10, 0, total, true);
   }
</script>
```

## See Also

[GetRowCount](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members/clientscript-allmeths/CSSR-GetRowCount)
[Scripting Members](/spreadnet/docs/latest/online-asp/overview/spweb-clientscriptref/clientscript-members)