Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Removing leading and trailing quotation marks in Google Sheets / Apps script

I am writing a script to populate a cell with some information for a mailer. I'm fairly new to this, so am guessing the coding isn't perfect. However, all I really need to achieve is to get a block of text - and it's pretty much there.

The problem is, that when it returns the text it adds a qutoation at start and at the end.

Can someone let me know how to return the text without this.

function MailerText(strMailer, strName) {
  
  if (strMailer === undefined || strMailer === "Ignore") {return ""};
  
  let  varBody
  let  ss = SpreadsheetApp.getActiveSpreadsheet();
  var formS = ss.getSheetByName("Actions");

  
  if (strMailer == 'A Style English') {varBody = formS.getRange('C1').getValue(); varSalutation = formS.getRange('B1').getValue();}
  else if (strMailer == 'A Style German - Female') {varBody = formS.getRange('C2').getValue(); varSalutation = formS.getRange('B2').getValue();};
  
  if (varBody == undefined) {return ""};
  return varSalutation + ' ' + strName + ',' + "\n" + "\n" + varBody; 

}

As requested, here are a few screen shots of the issue:

Image 1: The function call from the cell

Image 2: How it looks in Sheets after the function call

Image 3: What you get when you copy/paste the text into something.

The function call from the cell

How it looks in Sheets

When you copy the cell and paste it into something, you have the quotation marks

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

In this case after researching for a while it seems that whenever Sheets detects that there are special characters or line breaks you will get the quotation marks added when the text is copied, there is a similar post about this behavior and it contains a good workaround if you don't mind copying the text to a different cell then you can try this formula on another cell:

=SUBSTITUTE(C609,char(10),char(13))

This would basically copy the text without the special characters on it and when copy/pasted from the cell where the formula is added then you will see that the quotations will no longer be there.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!