title: Changing background color of specific cell on Google sheet
body: <p>I am working on this script bound to a Google Sheets spreadsheet where I have this function running from a time-driven trigger. I would like to be able to target specific cells on the sheet (if the cell value = &quot;Open&quot;) so that I can change the background color of the cell.</p>
  <p>I am wondering how can I go about making this work? I am able to target the cell, however, I don't know how to change the property of the cell background as the <code>.setBackground()</code> cannot be called.</p>
  <pre><code>function myColorFunction() {
    var s = SpreadsheetApp.getActiveSheet();
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var range = ss.getSheetByName(&quot;Form Responses 1&quot;).getRange(2,6,ss.getLastRow());
    var cellRange = range.getValues();
    Logger.log(cellRange);
    Logger.log(cellRange.length);
    Logger.log(cellRange.valueOf());
  
    for(i = 1; i&lt;cellRange.length; i++){
       if(cellRange[i] == &quot;Open&quot;)
       {
         Logger.log(&quot;change color here&quot;);
       } else {
         Logger.log(&quot;don't change color&quot;);
       } 
    }
  }
  </code></pre>