title: How to auto run Google Apps Script and auto update the google sheet?
body: <p>I am a beginner in JavaScript and Google Apps Script.</p>
  
  <p>I have written a simple piece of code to track the placement status of students in a class, I want the program to run automatically and make changes in the fields in real time.</p>
  
  <p>For example, if a student enters 58% in 10th standard and press enter, the eligibility status should automatically change to "Not Eligible" and so on.
  is it possible to make a program that makes google sheet take the values automatically?</p>
  
  <p>I am pasting the code below for reference. Please tell how can I make google sheet automatically take the values.</p>
  
  <pre><code>function placementMonitoring() {
      var app = SpreadsheetApp;
  
      //Get current active sheet
      var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
      var someCell = activeSheet.getRange(3, 6).getValue();
      Logger.log(someCell);
  
      //var newCell=activeSheet.getRange(3,3).setValue(someCell+1)
      for (var i = 3; i &lt;= 59; i++) {
          var someCell1 = activeSheet.getRange(i, 6).getValue();
  
          //attempt code for DEBARRED
          if (someCell1 == "D") {
              var attempt = 0;
              activeSheet.getRange(i, 7).setValue(attempt);
          } else
  
              //attempt code for PARTIALY DEBARED 
              if (someCell1 == "PD") {
                  attempt = 5;
                  activeSheet.getRange(i, 7).setValue(attempt);
              } else
  
                  // attempt code for unplaced students
                  if (someCell1 = "UP") {
                      attempt = "NOT APPLICABLE";
                      activeSheet.getRange(i, 7).setValue(attempt);
                  }
      }
      for (var i = 3; i &lt;= 59; i++) {
          var someCell2 = activeSheet.getRange(i, 12).getValue();
          var someCell3 = activeSheet.getRange(i, 15).getValue();
          var someCell4 = activeSheet.getRange(i, 18).getValue();
          var someCell5 = activeSheet.getRange(i, 20).getValue();
          var someCell6 = activeSheet.getRange(i, 21).getValue();
          if (someCell2 == 60 &amp;&amp; someCell3 == 60 &amp;&amp; someCell4 == 60 &amp;&amp; someCell5 == 60 &amp;&amp;
              someCell6 == 60) {
              var eligibility = " Eligible";
              activeSheet.getRange(i, 8).setValue(eligibility);
          } else {
              var eligibility = "Not Eligible";
              activeSheet.getRange(i, 8).setValue(eligibility);
          }
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/OWtdL.png" rel="nofollow noreferrer">here is picture of my spreadsheet</a></p>