title: Cannot read property 'getRange' of null
body: <p>I am using the below filter function to copy data from one sheet to another,
  filtering out so that it only saved data in the 'Data Entry' if column Q23 = FALSE.
  I already treat Q23 as a text (=TO_TEXT(R29))</p>
  <pre><code>function SubmitData01() {
    
    var ss        = SpreadsheetApp.getActiveSpreadsheet();
    var where     = ss.getSheetByName('Data Entry');
    var triggerCell = where.getRange('Q29').getValue();
        
    if (triggerCell == 'TRUE'){} else  // If the cell is true do nothing
    if (triggerCell == 'FALSE'){   // If the cell is false run the script
    
    var ss        = SpreadsheetApp.getActiveSpreadsheet();
    var formSS    = ss.getSheetByName('Data Entry');
    var datasheet = ss.getSheetByName('Address'); 
    var values = [[formSS.getRange(&quot;A29&quot;).getValue(), 
                   formSS.getRange(&quot;I9&quot;).getValue(),formSS.getRange(&quot;E9&quot;).getValue(), 
                   formSS.getRange(&quot;E10&quot;).getValue(),]];
    
                  datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 4).setValues(values);
         }
  </code></pre>
  <p>When I use the above script, I get the error message:</p>
  <blockquote>
  <p>&quot;Cannot read property 'getRange' of null (line 5, file &quot;saved&quot;)&quot;.</p>
  </blockquote>