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

196
Views
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 answers
Answer question

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 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!