title: "The starting column of the range is too small" error
body: <p>Here's an example of my script that is working:</p>
  <pre><code>    function onFormSubmit(e) {
  var date = e.values[0];
  var user = e.values[1];
  var busUnit = e.values[2];
  var body = &quot;Request for Add-On form submission&quot; +&quot;\n\n&quot;+&quot;Date:\t\t\t\t&quot;+date +&quot;\n&quot;+ &quot;Employee Email:\t\t&quot;+user +&quot;\n&quot;+&quot;Business Unit:\t\t&quot;+busUnit +&quot;\n\n&quot; +&quot;Form Responses:\t\t&quot; + &quot;https://docs.google.com/spreadsheets/d/ID/&quot;;
  
      if (busUnit==&quot;Acme&quot;) 
    {
      MailApp.sendEmail(&quot;admin@acme.com&quot;, &quot;Request for Add-On Submission&quot;,body);
      }
      
      if (busUnit==&quot;fakename&quot;)
     {
       MailApp.sendEmail(&quot;admin@fakename.com&quot;, &quot;Request for Add-On Submission&quot;,body);
       }
     
     if (busUnit==&quot;fakename2&quot;)
     {
       MailApp.sendEmail(&quot;admin@fakename.com&quot;, &quot;Request for Add-On Submission&quot;,body);
       }
  
  }
  
  function getColIndexByName(colName) {
    var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    var numColumns = sheet.getLastColumn();
    var row = sheet.getRange(1, 1, 1, numColumns).getValues();
    for (i in row[0]) {
      var name = row[0][i];
      if (name == colName) {
        return parseInt(i) + 1;
      }
    }
    return -1;
  }
  
  function emailStatusUpdates() {
    var sheet = SpreadsheetApp.getActiveSheet();
    var row = sheet.getActiveRange().getRowIndex();
    var Email = &quot;alladmins@fakename.com&quot;;
    var subject = &quot;Add-On Request Update&quot;;
    var body = &quot;The Fake Team has updated the status of the latest request.\n\nStatus: &quot; + sheet.getRange(row, getColIndexByName(&quot;approval status&quot;)).getValue();
    body += &quot;\n\nRequest: &quot; + sheet.getRange(row, getColIndexByName(&quot;What are you requesting to have approved?&quot;)).getValue();
    body += &quot;\n\nDescription: &quot; + sheet.getRange(row, getColIndexByName(&quot;Provide a brief description&quot;)).getValue();
   //body += &quot;\n\nNotes: &quot; + sheet.getRange(row, getColIndexByName(&quot;Notes&quot;)).getValue();
   //body += &quot;\n\nURL: &quot;+ &quot;https://docs.google.com/spreadsheets/d/ID/&quot;;
  
    MailApp.sendEmail(Email, subject, body, {name:&quot;The Fake Team&quot;});
  }
  
  function onOpen() {
    var subMenus = [{name:&quot;Send Approval Status&quot;, functionName: &quot;emailStatusUpdates&quot;}];
    SpreadsheetApp.getActiveSpreadsheet().addMenu(&quot;Send Status Update&quot;, subMenus);
  }
  </code></pre>
  <p>I want to enable the last 2 <code>body +=</code> rows. When I do that, I get this error:</p>
  <blockquote>
  <p>Exception: The starting column of the range is too small.at emailStatusUpdates(Code:45:99)</p>
  </blockquote>
  <p>I tried changing this line to <code>var row = sheet.getRange(1, 1, 1, 4, numColumns).getValues();</code>, but then I get this error:</p>
  <blockquote>
  <p>Exception: The parameters (number,number,number,number) don't match the method signature for SpreadsheetApp.Sheet.getRange.
  at getColIndexByName(Code:30:19)
  at emailStatusUpdates(Code:45:113)</p>
  </blockquote>