Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda