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

136
Views
From a named range, select one column but not the header row

I can make this work for a whole column, but if I have a NamedRange, I'll call food as follows.

Vegetables Fruit Meat
Carrot Apple Pork
Potato Orange Chicken
Turnip Pear Beef

Then I want to grab the column below the first row and then add that to a drop-down.

I know how to populate the drop-down, and I can grab a whole column using Map, but how do I get just the items below the first row.


I've created the following working script, but when you Logger.log (oneSet)

I get the whole column, including the heading. Instead, I want the relevant column of data without the heading.

function selectCol(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var foodList = ss.getRangeByName("Food").getValues();

var oneSet = foodList.map(oneCol);

function oneCol(one){
      return one[2]
    };
Logger.log(oneSet);

// [0] returns [Vegetables, Carrot, Potato, Turnip]
// [1] returns [Fruits, Apple, Orange, Pear]
// [2] returns [Meats, Pork, Chicken, Beef]

// So what I want is:
// [0] to return [Carrot, Potato, Turnip]
// [1] to return [Apple, Orange, Pear]
// [2] to return [Pork, Chicken, Beef]

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

0

This function builds all three and places them right below each list.

function makeADropDown() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet0');
  const vs = sh.getDataRange().getDisplayValues();
  [...Array.from(Array(3).keys())].forEach(idx => {
    let r =SpreadsheetApp.newDataValidation().requireValueInRange(sh.getRange(2,idx + 1,sh.getLastRow()-1,1)).build();
    sh.getRange(sh.getLastRow() + 1,idx + 1).setDataValidation(r);
  })
}

enter image description here

This line just creates and array like [0,1,2] to run through the loop 3 times.

[...Array.from(Array(3).keys())]

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!