1
votes

I want to specify a filter by the first column, which has a numbers more than 1000 and also hide "England" and "France". But I have Error:

Invalid value at 'requests[0].set_basic_filter.filter.criteria[0].value.condition.values' 

The code of program below:

function setFilters() {
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var filterSettings = {};  
      // The range of data on which you want to apply the filter.
      // optional arguments: startRowIndex, startColumnIndex, endRowIndex, endColumnIndex
      filterSettings.range = {
        sheetId: ss.getActiveSheet().getSheetId(),
        startRowIndex: 1
      };
     // Criteria for showing/hiding rows in a filter
      // https://developers.google.com/sheets/api/reference/rest/v4/FilterCriteria
      filterSettings.criteria = {};
      var columnIndex = 1;
      //

      filterSettings['criteria'][columnIndex] = {
        'hiddenValues': ["England", "France"],
        'condition': { "type": "NUMBER_GREATER","values":1000}
      };  
      var request = {
        "setBasicFilter": {
          "filter": filterSettings
        }
      };
      Sheets.Spreadsheets.batchUpdate({'requests': [request]}, ss.getId());   
    }

Whats wrong?

1
Random shot: Maybe "values":"1000" or "values":{"userEnteredValue":1000} or "values":{"userEnteredValue":"1000"} ?? - TheMaster
Test your request code using the Google APIs Explorer - it has an interactive builder! - tehhowch

1 Answers

0
votes

"values":{"userEnteredValue":"1000"} - It's work