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

192
Visualizações
Apps Scripts Hojas de cálculo de Google - Mover fila según el valor de la celda

No soy un codificador, y trato de manipular algún código (preexistente/algunos agregados por un socio) pero sigo luchando en una pequeña sección/problema.

script (original) escrito en getRow con active

 // Get the number of the row to move var rowToMove = activeSheet.getActiveRange().getRow(); Logger.log("rowToMove: " + rowToMove);

tratando de cambiar para que getRow se base en el valor de la celda. Lo he llevado a donde busca un rango definido. Pero tratar de obtenerlo, según el valor, preformar getRow como lo hizo en el código anterior ... no tuvo éxito.

cualquier sugerencia es bienvenida, feliz de proporcionar más información también. captura de pantalla de la hoja de cálculo

 function moveRows(){ Logger.log("moveRows.gs > moveRows"); // Confirmation check var ui = SpreadsheetApp.getUi(); var response = ui.alert("Move Row", "Confirm Completed Tasks", ui.ButtonSet.YES_NO); if (response == ui.Button.YES) { // Start: Get the data to move // Get the current sheet object var activeSheet = SpreadsheetApp.getActiveSheet(); // Get the number of columns var lastColumnOfDataInActiveSheet = activeSheet.getLastColumn(); Logger.log("lastColumnOfDataInActiveSheet: " + lastColumnOfDataInActiveSheet); **// Get the number of the row to move var rowToMove = activeSheet.getRange('E2:E500').getValues(); rowToMove.forEach( function (r, i) { Logger.log(r); if (r[0]) activeSheet.getRow(); }); // Get the range to move var rangeToCopyFrom = activeSheet.getRange(rowToMove, 1, 1, lastColumnOfDataInActiveSheet);** // End: Get the data to move // Start: Copy and paste the data // Get the target sheet var targetSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Completed"); // Get last row in target sheet var lastRowInTargetSheet = targetSheet.getLastRow(); Logger.log("lastRowInTargetSheet: " + lastRowInTargetSheet); // Get range to paste to var rangeToPasteTo = targetSheet.getRange(lastRowInTargetSheet + 1, 1, 1, lastColumnOfDataInActiveSheet); // Copy and paste the data rangeToCopyFrom.copyTo(rangeToPasteTo, {contentsFormat:true}); // End: Copy and paste the data // Clear the source data rangeToCopyFrom.clearContent(); // Sort the source sheet var lastRowOfDataInActiveSheet = activeSheet.getLastRow(); var rangeToSort = activeSheet.getRange(2, 1, lastRowOfDataInActiveSheet - 1, lastColumnOfDataInActiveSheet); rangeToSort.sort({column: 1, ascending: true}); // Pop up box tells you it's done }; // End: Confirmation check }; // End: moveRows
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Dirija mis dos líneas comentadas y tal vez pueda hacer que funcione

 function moveRows(){ var ui = SpreadsheetApp.getUi(); var response = ui.alert("Move Row", "Confirm Completed Tasks", ui.ButtonSet.YES_NO); if (response == ui.Button.YES) { var ash = SpreadsheetApp.getActiveSheet(); var avs = ash.getRange('E2:E500').getValues(); avs.forEach( function (r, i) { if (r[0]) ash.getRow();//there is no sheet.getRow(); }); var srg = ash.getRange(avs, 1, 1, ash.getLastColumn());//avs is a two dimensional array of data not a number var tsh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Completed"); var trg = tsh.getRange(tsh.getLastRow() + 1,1); srg.copyTo(trg, {contentsFormat:true}); srg.clearContent(); var rangeToSort = ash.getRange(2, 1, ash.getLastRow() - 1, ash.getLastColumn()); rangeToSort.sort({column: 1, ascending: true}); }; };
about 4 years ago · Santiago Trujillo 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