-2

I'm trying to split multylines in a cell using '\n' with the following code, however, the logger returns [] empty list can somebody help me out finding the issue
Thanks in advance

for (var i = 0; i < lrIndexArtf; i++) {
  if (rngArtf[i] != "") {
    var cellValue = rngArtf[i].toString();
    var linesArray = cellValue.split('\n');

    for (var k = 0; k < linesArray.length; k++) {
      data_list.push(linesArray[k]);
    }

  }

} //end of loop
Logger.log(data_list)
3
  • Show cellValue. It probably doesn't contain \n
    – TheMaster
    Commented May 17, 2020 at 14:03
  • Please define lrIndexArtf
    – Cooper
    Commented May 17, 2020 at 15:47
  • Please add a minimal reproducible example
    – Wicket
    Commented Jun 27, 2020 at 19:11

1 Answer 1

0

Use fromCharCode

String.fromCharCode(10);

There is a chance it is char(13). See this post for more detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.