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

165
Views
script de la aplicación hoja de google getLastRow comienza desde una columna específica para poner datos

Necesito poner datos en la hoja por secuencia de comandos de la aplicación usando getLastRow para poner cada valor debajo del último valor:

 function addData(name, age, gender) { var ss= SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Sheet2"); var currentRow = sheet .getLastRow(); var nextRow = currentRow + 1; sheet .getRange(nextRow,5).setValue(name); sheet .getRange(nextRow,6).setValue(age); sheet .getRange(nextRow,7).setValue(gender); }

Tengo datos que se usan antes de la columna 5 y los datos se colocan después de nextRow para la columna antes que la columna 5

ingrese la descripción de la imagen aquí

Quiero poner obtener el resultado así:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

La respuesta es:

 function addData(name, age, gender) { var ss= SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("Sheet2"); var startcolumn = tableSheet.getRange("E1:E").getValues(); var currentRow = startcolumn.filter(String).length var nextRow = currentRow + 1; sheet .getRange(nextRow,5).setValue(name); sheet .getRange(nextRow,6).setValue(age); sheet .getRange(nextRow,7).setValue(gender); }
about 4 years ago · Juan Pablo Isaza Report

0

Esto funcionará siempre que la columna en la que desea insertar el valor esté "clara", lo que significa que no hay posibilidad de que haya datos antiguos o celdas vacías debajo del punto de ubicación.

Cambio

 var currentRow = sheet .getLastRow();

A

 var currentRow = sheet.getRange(1,5).getNextDataCell(SpreadsheetApp.Direction.DOWN).getRow();
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!