title: Uncaught TypeError: Cannot read properties of null (reading 'slice') ------ Uncaught TypeError: Cannot read properties of undefined (reading 'filter')
body: <p>I really appreciate some help with this code. It was working before in google sheets but suddenly started showing up with error messages.</p>
  <p>The full code is below :</p>
  <pre><code>function getDataForSearch() {
  
    const ss = SpreadsheetApp.getActiveSpreadsheet();
    const ws = ss.getSheetByName(&quot;TEST FORMULAR&quot;);
    return ws.getRange(6, 1, ws.getLastRow()-1, 6).getValues();
    
  }
  </code></pre>
  <pre><code>
  function setDataForSearch(){
  
          google.script.run.withSuccessHandler(function(dataReturned){
            data = dataReturned.slice();
          }).getDataForSearch();
  
        }
  
  </code></pre>
  <pre><code>      
        function search(){
  
          var searchInput = document.getElementById(&quot;searchInput&quot;).value.toString().toLowerCase().trim();
          var searchWords = searchInput.split(/\s+/);
          var searchColumns = [0];
  
          var resultsArray = searchInput == &quot;&quot; ? [] : data.filter(function(r){
  
            return searchWords.every(function(word){
              return searchColumns.some(function(colIndex){
                return r[colIndex].toString().toLowerCase().indexOf(word) != -1;
              });
            });
      
          });
  
          var searchResultsBox =  document.getElementById(&quot;searchResults&quot;);
          var templateBox = document.getElementById(&quot;rowTemplate&quot;);
          var template = templateBox.content;
  
          searchResultsBox.innerHTML = &quot;&quot;;
  
          resultsArray.forEach(function(r){
  
            var tr = template.cloneNode(true);
            var typeInitiativeColumn = tr.querySelector(&quot;.type-initiative&quot;);
            var pepRefColumn = tr.querySelector(&quot;.pep-ref&quot;);
            var projectNameColumn = tr.querySelector(&quot;.project-name&quot;);
  
            pepRefColumn.textContent = r[0];
            typeInitiativeColumn.textContent = r[1];
            projectNameColumn.textContent = r[2];
            searchResultsBox.appendChild(tr);
  
          });
  
        }
  </code></pre>