title: Google Script Apps - Capitalize first letter of each word of input string in cell
body: <p>I am looking for a solution that capitalizes each word of the input string to cell seperated by blank space or dot (similar to <code>proper</code> function). I know it is broken but what I tried so far:</p>
  
  <pre><code>    /*Capitalize Firt Letter of Each Word of input String in Cell*/
    if(activeRow &gt; 1 &amp;&amp; activeCol == 3 &amp;&amp; ss.getSheetName() == validSheet &amp;&amp; activeCell.isBlank() == false)
    { 
      var inputVal = activeCell.getValue().toString();
      Logger.log(inputVal);
      activeCell.setFormulaR1C1("=PROPER("+inputVal+")");
    }
  </code></pre>
  
  <p>Example: </p>
  
  <p>Input for cell A2:</p>
  
  <pre><code>this tExt neEds to be fixed
  </code></pre>
  
  <p>Output (Desired Result) for cell A2:</p>
  
  <pre><code>This Text Needs To Be Fixed
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>Edit 1: I noticed that proper function won't work because it requires cell value in it.</p>