title: Simple google apps workflow Form->Spreadsheet->email Manager->Update spreadsheet & Requestor
body: <p>I have created a Form that write to a spreadsheet.
  The Apps script runs onSubmit and looks for new data and sends an email to a manager
  The manager received the email with an Approve button. </p>
  
  <p>I can't post the approvers response back to the spreadsheet.</p>
  
  <p>When the approver selects the button the message "Script function not found: doPost"</p>
  
  <pre><code>var COLUMN_STATE = 4; //the number is the column # + 1  6 = column G (7th column)
  var COLUMN_APROVE = 5
  var STATE_APPROVED = "APPROVED";
  var STATE_REJECTED = "REJECTED";
  var STATE_MANAGER_EMAIL = "MANAGER_EMAIL";
  
  var REQUEST_SPREADSHEET_ID = "0AkbHPyoRSG2DdDJpaWd1bGEzb19HY2pjVHdiQUhxNUE";
  
  // Main tutorial function: For each row
  //   - if it has recently been APPROVED or REJECTED by a manager, email the results to 
  
  function onRequest() {
    // This is the Request Spreadsheet
    var ss = SpreadsheetApp.openById(REQUEST_SPREADSHEET_ID);
    var sheet = ss.getSheets()[0];
  
    // Fetch all the data from the Request Spreadsheet
    // getRowsData was reused from Reading Spreadsheet Data using JavaScript Objects 
    var data = getRowsData(sheet);
  
    // For every Request
    for (var i = 0; i &lt; data.length; ++i) {
      var row = data[i];
      row.rowNumber = i + 2;
      if (!row.state) {
        // This is a new Request
        // Email the manager to request for approval.
        sendReportToManager(row);// Update the state of the Request
        sheet.getRange(row.rowNumber, COLUMN_STATE).setValue(row.state);
      } 
     }
    }
  
  
  // Sends an email to a manager to request approval 
  function sendReportToManager(row) {
    var subject = "ID#" + " " + row.rowNumber + " "+"Request for Time Off"
    var message ='&lt;form action="xxxx" method="Post"&gt;' +
        "&lt;P&gt;" + "Request Id: " + row.rowNumber + "&lt;/P&gt;"+ 
        "&lt;P&gt;" + row.username + " has requested your approval for Time Off." + "&lt;/P&gt;"+ 
        '&lt;input type="hidden" name="row" value="' + row.rowNumber +'" /&gt; ' +
        '&lt;input type="submit" value="Submit" /&gt;' +
        '&lt;/form&gt;';
        //(Logger.log(row));
    MailApp.sendEmail(row.supervisorsEmail,subject, "", {htmlBody: message});
    row.state = STATE_MANAGER_EMAIL;
  }
  
  function doPost(e) {
    var template = HtmlService.createTemplateFromFile('Thanks.html');
    template.name = e.parameter.name;
    template.comment = e.parameter.comment;
    template.screenshot = e.parameter.screenshot;
    return template.evaluate();
    (Logger.log(e));
  }
  </code></pre>