问题
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