无法将换行符添加到Google脚本 [英] Can't add line breaks to google script

查看:57
本文介绍了无法将换行符添加到Google脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Google工作表,上面有我想在电子邮件中使用的文字.该工作表包含50行和3列文本,按要求设置格式.我已经编写了可以捕获工作表内容的代码,但是在我想要的地方没有换行符(很有趣,在行尾)它将工作表数据作为一整段文本返回.

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.

我尝试了 \ n char(10)

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

我认为这可能很简单,在每行的末尾添加LF,但是数组无法识别换行符?

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

推荐答案

尝试:

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

这篇关于无法将换行符添加到Google脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆