Can't add line breaks to google script

Deadly 提交于 2021-01-07 04:37:35

问题


I have a google sheet with the text I wish to use in an email. The sheet has 50 rows and 3 columns of text, formatted as required. I have written code that will grab the sheet contents, but it doesn't have line feeds where I want them (funnily enough, at the end of the lines) It returns the sheet data as one lump of text.

I have tried \n and char(10)

var EmailLines = sSheet.getRange(startRow, startCol, numRows).getValues();

I thought it might be a simple add the LF at the end of each line but the array doesn't recognise line feeds ?


回答1:


Try:

var text=EmailLines.join('\r\n');



来源:https://stackoverflow.com/questions/58019509/cant-add-line-breaks-to-google-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!