title: How do I create an Auto-Clear Script in a Google Spreadsheet?
body: <p>I could use some help with writing a script in my Google spreadsheet.  First off, I am no programmer and a novice at best on writing code or any script.  </p>
  
  <p>I want to use this for a lunch list.  The back story: I created Google spreadsheets to act as a digital lunch sheet.  Each teacher has their own spreadsheet for their homeroom and the totals for the class populate a master lunch sheet for the head cafeteria worker for ordering.  The problem is that the old totals are still present from the day before.  Ideally, on the start of a new day, the specified fields on the spreadsheet will auto clear.  <a href="https://docs.google.com/spreadsheet/ccc?key=0AigfwqBbSV6CdHZCX21vVXBHaVdqVG1nOENvZEx0MVE&amp;usp=sharing" rel="noreferrer">Click here to view an example of the spreadsheet I created.</a></p>
  
  <p>In my research I found a thread on how to create a script to do this, but as a button to click that will then clear specified ranges <a href="https://stackoverflow.com/questions/9268570/i-need-a-button-to-clear-cells-in-a-google-spreadsheet">Click here to see the original post</a>.  The script is as followed:</p>
  
  <pre><code>function clearRange() {
    //replace 'Sheet1' with your actual sheet name
    var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1');
    sheet.getRange('C4:I12').clearContent();}
  </code></pre>
  
  <p>What I would like for is there to be a script so that everyday (say everyday at midnight) a specific field/ range is cleared out.  I <strong>do not</strong> want columns or rows to delete because I do not want to lose student names or lunch selections.  </p>
  
  <p>Please, any help is greatly appreciated.  Thanks in advance for your help, especially with a novice like me.  I look forward to hearing from anyone!
  <br>- Jason</p>