Spreadsheet - Google App Script [string split function]

J.Doe, I cannot submit a comment either, but your problem here is that if you get the value from a form, its type can be an object instead of a string. Hence you are getting the error of no function in object.

You can go around this by converting those objects to strings this way:

objectPretendingString = JSON.stringify(objectPretendingString) //becomes a string

Your code should definitely work, I just ran this with a breakpoint on Logger.log(array1); The debugger shows it as an array, and the log logs it as: [A, B, C, D]. Note, that to get the output you wanted I had to add a space to the split to get: string1.split(", ");

function myFunction() {
  var array1 = splitTest();
  Logger.log(array1);
}

function splitTest() {
  var array1 = [{}];
  var string1 = "A, B, C, D";

  array1 = string1.split(", ");
  return array1
}