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

141
Visualizações
Skipping cell in loop, and tweaking a function to move range

I have a google sheet for my business that creates a prep list for events.

After tackling an automatic clearing issue for over 25 hours(serious);I got some help from your fantastic community, modified the code to work, see below: (If Fx is empty, clear the cell to the left):

function cgar() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('auto');
  var values = sheet.getRange("F11:F20").getValues();
  var ranges = values.reduce((ar, [f], i) => {
    if (f == "") ar.push("E" + (i + 11));
    return ar;
  }, []);
  sheet.getRangeList(ranges).clearContent();
}
  1. Is there a way for me to skip a specific cell, either based on location or value = "Garnish"?

If I change the code to take the whole range of "F5:F24" instead of the individual groups "F11:F20" it clears the header rows of the merged cell E10:F10 & E21:F21.

2.


  var syr1 = ("D6")
  var syr2 = ("D7")

  var syr1isblank = SpreadsheetApp.getActiveSheet().getRange(syr1).isBlank()
  var syr2isblank = SpreadsheetApp.getActiveSheet().getRange(syr2).isBlank()


  if (syr1isblank == true) {
  SpreadsheetApp.getActiveSheet().getRange("C16:D23").moveTo(sheet.getRange(syr1))
    }
    else if (syr2isblank == true && syr1isblank == false ) {
  SpreadsheetApp.getActiveSheet().getRange("C16:D23").moveTo(sheet.getRange(syr2))
  }

I have been using if and else if to move the group ranges that are below the cleared ones to the newly created space above, but it's clunky:

Is there a way that I can also modify this to scan for empty range, I think the process would be like this:

  • first empty cell spotted

  • Mark the cell to the left to a variable?

  • Scan the range f.x. E11:F20 for lastRow after it has been cleared by the function above

  • Move the range to the variable marked cell above.

Image of the sheet in question: https://i.stack.imgur.com/ND2DC.png

I would greatly appreciate any assistance, thank you.

about 4 years ago · Juan Pablo Isaza
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