Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
create an object with different ranch of data on Google App Script

I want to create a function that creates 2 different objects with a different ranch of data from a Sheet. But it says :
Exception: The parameters (String, String, String, String, String, String, String) don't match the method signature for SpreadsheetApp.Sheet.getRangeList. the mistake is from the variable let data_Spiceblend

P.S: I'm just a beginner in programming so if you find this question stupid I'm sorry :/ That's what i did :

  let sheet = openSheet("Spices list");
  let data_SpiceBlend = sheet.getRangeList('B67:B83','B85:B86','B88:B114','B116:B134','B136:B147','B149:B154','B156:B223','B225').getValues();
  let data_SpiceMix = sheet.getRange("B21:B65","B232:B242").getValues();

  let blend_Obj = {};
  let mix_Obj = {};
  let blendSku = data_SpiceBlend[0];
  let mixSku = data_SpiceMix[0];
  let blendContent = [];
  let mixContent = [];

  for (let row of data_SpiceBlend) {
   obj[blendSku] = blendContent;
   blendSku = row[0];
   blendContent = []; 
    }
  

  for (let row of data_SpiceMix) {
      obj[mixSku] = mixContent;
      mixSku = row[0];
      mixContent = [];
    }
  
  blend_Obj[blendSku] = blendContent;
  mix_Obj[mixSku] = mixContent;
  model.blend = blend_Obj;
  model.mix = mix_Obj;
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Answer:

The getRangeList() method takes an array of ranges, specified as strings.

Code Change:

let data_SpiceBlend = sheet.getRangeList('B67:B83','B85:B86','B88:B114','B116:B134','B136:B147','B149:B154','B156:B223','B225').getValues()

should be:

let data_SpiceBlend = sheet.getRangeList(['B67:B83','B85:B86','B88:B114','B116:B134','B136:B147','B149:B154','B156:B223','B225']).getRanges().getValues()

Note the [] encapsulating the list of A1 notations.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda