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

191
Vistas
How can I write this array to one cell and have it like a text using GAS?

This seems simple, but I'm sure.

The array is writte like this: ["amarelo primavera","amarelo suave","amarelo suave + azul céu","azul caribe"]

But it should be written like this: amarelo primavera, amarelo suave, amarelo suave + azul céu, azul caribe

I'm using setValue() to range A1 and I've tried replace(), JSON.stringify(), but none of them get me where I need.

Here's the output I get, when using the suggestion you made: enter image description here

Here's the code snippet:

function pasteColors(selectedColors) {
  const cadProdutoSheet = ss.getSheetByName('Cadastro de Produto');
  Logger.log('SelectedeColor Array: ' + selectedColors);
  cadProdutoSheet.getRange("D39").setValue(JSON.stringify(selectedColors));
  SpreadsheetApp.flush();
  let a  = JSON.parse(cadProdutoSheet.getRange("D39").getValue());
  Logger.log('A: ' + a);
  cadProdutoSheet.getRange(39,4).setValue(a.join(","));
}

Thank you!

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

0

function myfunk() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName("Sheet0");
  const array = ["a","b","c","d","e"];
  sh.getRange(1,1).setValue(JSON.stringify(array));
  SpreadsheetApp.flush();
  let a = JSON.parse(sh.getRange(1,1).getValue());
  Logger.log(a.join(','));
  sh.getRange(2,1).setValue(a.join(","));
}

Execution log
3:34:09 PM  Notice  Execution started
3:34:11 PM  Info    a,b,c,d,e
3:34:11 PM  Notice  Execution completed

CELL:

enter image description here

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