简体   繁体   中英

How To Add Break Line From App Script To Google Sheet

I'm trying to add a break line between array to Google Sheet. I tried <br> and &#10; but it doesn't work and shows those text between the array in Google Sheet instead. Is there a way to do it? Your response would be very appreciated.

Here's my.gs code:

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ws = ss.getSheetByName("Sheet1");
  var data = ws.getRange(5, 1, ws.getLastRow()-1, 9).getValues();
  var codeList = data.map(function(r){return r[0].toString(); });
  var thingsList = data.map(function(r){return r[8]; });
  var position = codeList.indexOf(formObject.codeInput);

  var array = [thingsList[position], formObject.things].join('<br>').toString();
  if (position > -1) {
    position += 5;
    ws.getRange(position,9).setValue(array);
  }

Is this what your looking for:

function writem() {
  SpreadsheetApp.getActiveSheet().getRange('A1').setValue([1,2,3,4,5,6,7,8,9].join('\r\n'));
}

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM