Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
How to format js strings to have a Google Sheet/Excel line break in a single cell?

Background

I'm trying to format some strings using plain JavaScript. It will be copy-pasted to a single cell in Google Sheet with a line break (alt + enter) in between. For example,

Sample Image

Code

let result = 'info1'
result += ', '         // replace with a line break
result += 'info2'

CopyToClipboard(result)

Problem

My closest attempt was using Google Sheet equation and char(10)

let result = '="info1"&char(10)&"info2"'

But since this solution changes the actual data, it's difficult to edit and reuse from the end-user perspective. I thought there must be a simpler way like /t and /n.

My not so successful tries include:

String.fromCharCode(10)

/r //r /n //n /t //t

Any advice would be appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use backslash \ but not slash /

\n

var result;

result = 'info1'
result += '\n'
result += 'info2'
/* OR */
result = 'info1\ninfo2'

Alternative: Template literals

let result = `info1
info2`;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda