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

129
Views
Script AppendRow at the top

I have this little code to insert data from a form to a specific sheet.

function grabarEnSheets(e) {
  //Conectarse con sheets
  const libro=SpreadsheetApp.openById("SheetID")
  const hoja=libro.getSheetByName("Patrol-Logs")
  
  //Traer respuestas
  const respuestaEnviada=e.response;
  const respuestas=respuestaEnviada.getItemResponses();
  const Nombre = respuestas[0].getResponse();
  const Dia = respuestas[1].getResponse();
  const Tiempo = respuestas[2].getResponse();
  const Evidencia = respuestas[3].getResponse();
  const Traje = respuestas[4].getResponse();

  //Campos nuevos
  var fecha=new Date();

//Guardar respuestas en sheets
hoja.appendRow([fecha,Nombre,Tiempo,Dia,Evidencia,Traje])
}

function darPermisos(){
  SpreadsheetApp.openById("sheetID")
  FormApp.getActiveForm();
}

And the appendRow adds the data at the bottom of the sheet. So what I need is to append all entry data from the form and skip the first and second table. enter image description here

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

0

From your following replying in the comment,

I don't know how to make appendRow to start adding the data at the third file, and not at the bottom.

I thought that you might have wanted to append a data row to the 3rd tab on the Google Spreadsheet. If my understanding is correct, how about the following modification?

From:

hoja.appendRow([fecha,Nombre,Tiempo,Dia,Evidencia,Traje])

To:

libro.getSheets()[2].appendRow([fecha,Nombre,Tiempo,Dia,Evidencia,Traje]);
  • libro.getSheets()[2] means the 3rd tab on the active Spreadsheet.

  • If you want to use appendRow to the specific sheet, you can also use the following script using the sheet name.

      libro.getSheetByName("###SheetName###").appendRow([fecha,Nombre,Tiempo,Dia,Evidencia,Traje]);
    

Reference:

  • getSheets() of Class Spreadsheet
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!