I'm working with a Google Sheets form which also accepts answers via text message. I'm trying to work out a method using Google Apps Scripts to split the body of the text message using a comma as a delimiter.

The problem I'm running into is overwriting information submitted by the form and not by text message.

My current script is:
function splitCells() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
  var colC = sheet.getRange("C2:C").getValues();
  var colD = sheet.getRange("D2:D").getFormulas();
  //Logger.log(colC);
  for(var i in colC){
    if(typeof(colC[i][0]) =='string'){
      colD = '=if(istext(C2:C),split(C2:C,",",true))';
    } else {
      colD = 'D2:D';
    }
  }
  sheet.getRange("D2:D").setFormula(colD);
}
The function is working correctly, splitting the contents of column C (the SMS body) into D, E, and F as expected. But, it's overwriting data in column D because the else condition isn't being met (colC is blank in those places). 
How do I get the script to move over blank cells without replacing the contents of the cell?
It's sort of confusing to explain, so here's a sample document you can check out. A custom menu should install when you open it and you can run the script from there (or from the editor).
Thanks for the help.
 
     
    