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

137
Vistas
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 Respuestas
Responde la pregunta

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