0

The following code fails in Google scripts:

var criteria = SpreadsheetApp.newFilterCriteria()
  .setVisibleValues(["SuzieS","MaryA"])
  .build(); 

with an exception that visible values are not supported. But this parameter is documented.

I would like to set only one value as visible, then use that as a method of removing all rows that have that visible value. Since the column might have many distinct values, I don't want to list a whole bunch of hidden values.

I don't see Google documentation on a bug or on anything else. Anyone know? Thanks in advance.

Addition: Yes, I did see the question had been posed before, but the answer was a workaround.

I was asked for furthr information. I set up a simple spreadsheet with plain-text numbers in cells A1 to A16. Then I ran the following standalone script:

function testVisible(){

var sheetR =  
SpreadsheetApp.open(DriveApp.getFilesByName("TestSheet").next())
.getActiveSheet() ;  
var newFilter = sheetR.getRange("A:A").createFilter();
var criteria = 
SpreadsheetApp.newFilterCriteria().setVisibleValues(["1","4"]).build(); 
newFilter.setColumnFilterCriteria(1, criteria); 

}

and got an exception error that setVisibleValues is not supported.

  • Search the issuetracker or create a new issue in the tracker. See [tag info page](https://stackoverflow.com/tags/google-apps-script/info) for more details. Related: https://stackoverflow.com/q/51497982/ – TheMaster May 12 '20 at 07:29
  • I can't reproduce this behaviour in my environment; can you provide an example sanitised sheet for which this doesn't work? – Rafa Guillermo May 12 '20 at 11:35

0 Answers0