title: Filter Excluding Few Sheets in Google Apps Script
body: <p>I want to exclude two sheets <code>&quot;Summary&quot;</code> &amp; <code>&quot;Result&quot;</code> instead of this on the below script <code>filter(sheet =&gt; sheet.getName().endsWith(&quot;2020&quot;)</code></p>
  <p>On the other hand, I tried to include <code>2021</code> like this, but that didn't work <code>filter(sheet =&gt; sheet.getName().endsWith((&quot;2020&quot;,&quot;2021&quot;))</code></p>
  <p>The full script is here:</p>
  <pre><code>    function SUMMARIZE() {
    const ss = SpreadsheetApp.getActive();
    const weekSheets = ss.getSheets().filter(sheet =&gt; sheet.getName().endsWith(&quot;2020&quot;));
    const summarySheet = ss.getSheetByName(&quot;Summary&quot;);
    let weekData = weekSheets.map(weekSheet =&gt; {
      return weekSheet.getRange(2, 1, weekSheet.getLastRow() - 1).getValues();    
    }).flat();
  const getUnique_ = array2d =&gt; [...new Set(array2d.flat())];
    uniqueValues = getUnique_(weekData).map(e =&gt; [e]);
   
   var header = [[&quot;Company Name&quot;]];
        summarySheet.getRange(&quot;A1:A1&quot;).setValues(header);
        summarySheet.getRange(&quot;A2:A&quot;+(uniqueValues.length+1)).setValues(uniqueValues); 
  }
  </code></pre>
  <p>Update: I added sheet <a href="https://docs.google.com/spreadsheets/d/19l_gREqX1QfDHdNIjDFhW3-DNFwNKnzFWFWKXN1PaH8/edit?usp=sharing" rel="nofollow noreferrer">here</a></p>