Skip to main content Skip to footer

How to hide a column or a row with JavaScript

Background:

To hide a column or a row we will be using the setColumnVisiblw and setRowVisible methods.

Steps to Complete:

Hide a column by setting setColumnVisible to false

Hide a row by setting setRowVisible to false

Getting Started:

Hide a column by setting the visibility of the column to false using the setColumnVisible method.
This will hide columns B through:

activeSheet.setColumnVisible(1, false, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setColumnVisible(2, false, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setColumnVisible(3, false);

Hide a row by setting the visibility of a row to false using the setRowVisible method.
This will hide rows 5 through 7:

activeSheet.setRowVisibility(4, false, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setRowVisibility(5, false, GC.Spread.Sheets.SheetArea.viewport);
activeSheet.setRowVisibility(6, false);

Mackenzie Albitz