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

190
Views
How can I convert this object into an Array using GAS?

I got this showing as an object: 38,44,46 ...while and it should be: ["38","44","46"]

I'd like to convert it to an Array, so that I can iterate over it. I've tried doing so using this, but it's still an object, as I get its type: let tamanhosEsc = Object.values(values[29]);

This is how values is created:

const rngList = cadSheet.getRangeList(dataRng).getRanges();

  let values = new Array();

  for(let i = 0; i < rngList.length; i++) {
    let data = rngList[i].getValue();
    values.push([data]);
  }

I've tried creating it by specifying it as an Array, but still...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Play with the code above to understand the basic concept:

var obj = {"1":5,"2":7,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0}
var result = Object.keys(obj).map((key) => [Number(key), obj[key]]);

console.log(result);
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!