title: Using Google Script, is there a way to export results from running a function into a new sheet?
body: <p>Extremely in-experienced coder here, I want to run a regex function that searches for a set of words in a google sheet populated with transcripts, then export, I guess, the results into a new sheet.</p>
  
  <p>I have a script that does what I want but only shows the results of the regex function in the logs, i.e., it pastes the entire transcript that contains the target words. I would like to show the results in an actual sheet rather than in the logs.</p>
  
  <p>Any feedback would be really helpful, but I would ask you give feedback like you would to a 5 year old, as I said, extremely in-experienced coder here.</p>
  
  <pre><code>var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = SpreadsheetApp.getActiveSheet();
  
  var history = ss.getSheetByName('sheet1');
  ss.setActiveSheet(history);
  
  for(i = 1; i &lt;= history.getMaxRows(); i += 1) {
    var r = history.getRange('A' + i)
  
    var regexp = /\W*(identity)\W*\s+(\w+\s+){0,5}(verification)|(verification)\s+(\w+\s+){0,5}(identity)/
  
  
    if (regexp.exec(r.getValue()) !== null ) {
       Logger.log(r.getValue())
      } 
  
  }
  }
  </code></pre>