Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p> The issue tracker holds that request <a href="https://code.google.com/p/google-apps-script-issues/issues/detail?id=195" rel="nofollow">since Aug 3, 2010</a> with a Medium priority and just a "Triaged" status. More than 3 years and no signs of solution from the GAS team.</p> <p>My workaround was to use a special leading character that would indicate the visibility state of the row/column, it is a leading backtick (`) in the cells of top header row/column. In case if <strong>merged cells</strong> are used in column headers, then <strong>an empty top row should be dedicated</strong> just for that functionality until the google engineers will improve the API. Same applies if there are <strong>formulas</strong> in the 1st row/column cell(s). These <strong>dedicated rows/columns</strong> itself can be hidden.</p> <p>After starting to use this functionality each show/hide column/row command should be performed from a customized menu, otherwise there'll be errors when iterating through the range programmatically, because of the missing/excessive backtick.</p> <p>e.g. to hide rows of selected cells the following function is invoked</p> <pre class="lang-js prettyprint-override"><code>function hideSelectedRows() { var sheet = SpreadsheetApp.getActiveSheet(); var range = SpreadsheetApp.getActiveRange(); // hide rows and add a ` backtick to the header cell for (var row = range.getRow(); row &lt;= range.getLastRow(); row++) { // add backtick only if it isn't there (that may happen when manually unhiding the rows) var cellHeader = sheet.getRange(row, 1) var cellHeaderValue = cellHeader.getValue() if ( !cellHeaderValue.match(/^`/) ) { cellHeader.setValue('`' + cellHeaderValue) } // hide rows of selected range sheet.hideRows( row ); } } </code></pre> <p>and the menu</p> <pre class="lang-js prettyprint-override"><code>SpreadsheetApp.getActiveSpreadsheet() .addMenu("Show/Hide", [ { name : "Hide Selected Rows", functionName : "hideSelectedRows" }, { name : "Hide Selected Columns", functionName : "hideSelectedColumns" }, null, { name : "Hide Rows", functionName : "hideRows" }, { name : "Hide Columns", functionName : "hideColumns" }, null, { name : "Show Rows", functionName : "showRows" }, { name : "Show Columns", functionName : "showColumns" }, null, { name : "Show All Rows", functionName : "unHideAllRows" }, { name : "Show All Columns", functionName : "unHideAllColumns" } ]) </code></pre> <p>Once google engineers find the time to improve the onChange event, it will be possible to put those backticks automatically. Currently the changeType is limited to <a href="https://developers.google.com/apps-script/understanding_events" rel="nofollow">EDIT, INSERT_ROW, INSERT_COLUMN, REMOVE_ROW, REMOVE_COLUMN, INSERT_GRID, REMOVE_GRID, OTHER</a> without any details on which Row/Column was inserted/removed. Looks like the team behind GAS is scanty. I wish they could hire more programmers (khm khm)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload