title: Remove all filters in google sheets using google apps script
body: <p>I didn't want to revive an old thread posted years ago, so I'm starting a new one. The thread is <a href="https://stackoverflow.com/questions/26807618/how-can-i-remove-all-filters-in-a-google-spreadsheet-using-google-apps-script">over here</a></p>
  
  <p>In that thread, I found my answer. I needed the following script to remove filters in a sheet:</p>
  
  <pre><code>function clearFilter() {
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var ssId = ss.getId();
      var sheetId = ss.getActiveSheet().getSheetId();
      var requests = [{
          "clearBasicFilter": {
          "sheetId": sheetId
          }
      }];
      Sheets.Spreadsheets.batchUpdate({'requests': requests}, ssId);
  }
  </code></pre>
  
  <p>The problem is, the above code only removes filters in the current active sheet I'm using. What I want is to remove filters in ALL sheets. </p>
  
  <p>This is what I've tried:</p>
  
  <pre><code>function clearFilter() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var ssId = ss.getId();
    var sheetId = ss.getActiveSheet().getSheetId();
    var requests = [{
      "clearBasicFilter": {
        "sheetId": sheetId
      }
    }];
  
  
     for(var i = 0; i &lt; ss.length; i++) {
  
       Sheets.Spreadsheets.batchUpdate({'requests': requests}, ssId); 
     }
  }
  </code></pre>
  
  <p>Here I am trying to add a for loop to iterate through the entire workbook, but my for loop isn't exactly correct. Can someone please help me on this?</p>