google apps script - Googlesheets - javascript - Hide columns after column 21 that do not equal a given cells value -


itemprop = "text">

My goal is to hide all the columns in all the Google columns based on the text / value of a cell. Range & amp; With column 22 ("U"), the code will hide all the columns in this category, without any line ROW 1 in "J812" (i.e. 812,10), which is a drop down list Is selected through (via data validation).

I have been introduced to Java Script now, so please bear up on my innovation! Through search online, I have put my own solution together, the only problem is that when a script is completed, it shows an error ... in a red box, "call reference outside context". I do not know how this error has disappeared ... plz help

A part of my code comes from here ""

Here's my code: < / P>

  Hide function column () {var ss = SpreadsheetApp.getActiveSpreadsheet (); Var letter = ss.getActiveSheet (); // Get the data var data = sheet.getDataRange (); // Get the number of columns lastCol = data.getLastColumn () + 1; Logger.log (lastCol); // Call for call (var i = 1; i & lt; lastCol; i ++) {if.get (1, 21 + i) .getValue ()! == Sheet.Getrenz (812,10) .getValue ()) {Sheet.hideColumns (21 + i); }}}  

Any help would be appreciated!

The last call is your last column. 1. For your loop, you loop loop till lastCol, however this is 21 + i in getCell (), which means that you go 21 very far and therefore are out of range: -)

< / Html>

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -