I have a script that produces an automated email from cell content in a Google Sheet. Is it possible to restrict the width of a cell's output in the email, forcing the text to wrap? I have tried using textarea tags as follows:
+ <textarea rows="4" cols="20">
+ sheet.getRange(6,9,1,1).getValue()
+ </textarea>
However, this simply outputs as "+ sheet.getRange(6,9,1,1).getValue() +" (i.e. it doesn't generate the cell content).
Is this possible?
Here's how I have built the script:
function EmailFormConfirmation() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
Utilities.sleep(60000);
var sheet = ss.getSheetByName("Form responses");
var lock = LockService.getPublicLock();
lock.waitLock(60000);
lock.releaseLock();
var email = sheet.getRange(2,9,1,1).getValue();
var message = "<HTML><BODY>"
+ "<P >Hi "
+ sheet.getRange(4,9,1,1).getValue()
+ ","
etc.
EDIT The below produces the cell content, but doesn't wrap the text.
var htmlMsg = "<HTML><BODY>"
+ "<textarea rows='4' cols='10'>"
+ sheet.getRange(6,9,1,1).getValue()
+ "</textarea>"
+ "</HTML></BODY>";
MailApp.sendEmail(email, "LMI Request", "", {htmlBody: htmlMsg});
email[2][0]
and for the real emailemail[0][0]
. – Kriggs