I am creating an athlete training program and diary for athletes I coach. I created a sheet in which I set workloads of different items, and athletes record how much of the training plan they complete.

They then hit a save button at the top which transfers the data to a different spreadsheet which stores their training data.

The main page the athletes fill in has 4 sections, each with 10 rows that have drop down boxes to set the different training activities.

I have a code which is working, but is going to be very lengthy. Below is the code. Currently I will have to have 10 lots of the listed code (2 listed), for each of the 4 areas of training. This means 250 lines per section so 1000 lines for the whole code.

Seeing as I am just changing the `if` statement down 1 row at a time, and then all of the input ranges change accordingly, is there a way to shorten this code right down?

```
//Input values for routines data row 1
var routinesTRPDMT = inputS.getRange("A29").getValues(); 
if (routinesTRPDMT == "TRP"){
var routines = [[inputS.getRange("R1").getValue(),//DAY
inputS.getRange("V1").getValue(),//DATE
inputS.getRange("Z1").getValue(),//MONTH
inputS.getRange("AD1").getValue(),//SESSION
inputS.getRange("B29").getValue(),//ROUTINE
inputS.getRange("D29").getValue(),//SECTION
inputS.getRange("F29").getValue(),//REPS
inputS.getRange("J29").getValue(),//ATTEMPT 1
inputS.getRange("L29").getValue(),//ATTEMPT 2
inputS.getRange("N29").getValue(),//ATTEMPT 3
inputS.getRange("P29").getValue(),//ATTEMPT 4
inputS.getRange("R29").getValue(),//ATTEMPT 5
inputS.getRange("T29").getValue(),//ATTEMPT 6
inputS.getRange("V29").getValue(),//ATTEMPT 7
inputS.getRange("X29").getValue(),//ATTEMPT 8
inputS.getRange("Z29").getValue(),//ATTEMPT 9
inputS.getRange("AB29").getValue(),//ATTEMPT 10
inputS.getRange("AD29").getValue(),//ATTEMPT 11
inputS.getRange("AF29").getValue(),//ATTEMPT 12
dtCurrentTime]];

routinesS.getRange(routinesS.getLastRow()+1, 1, 1, 20).setValues(routines);

}   

//Input values for routines data row 2
var routinesTRPDMT = inputS.getRange("A30").getValues(); 
if (routinesTRPDMT == "TRP"){
var routines = [[inputS.getRange("R1").getValue(),//DAY
inputS.getRange("V1").getValue(),//DATE
inputS.getRange("Z1").getValue(),//MONTH
inputS.getRange("AD1").getValue(),//SESSION
inputS.getRange("B30").getValue(),//ROUTINE
inputS.getRange("D30").getValue(),//SECTION
inputS.getRange("F30").getValue(),//REPS
inputS.getRange("J30").getValue(),//ATTEMPT 1
inputS.getRange("L30").getValue(),//ATTEMPT 2
inputS.getRange("N30").getValue(),//ATTEMPT 3
inputS.getRange("P30").getValue(),//ATTEMPT 4
inputS.getRange("R30").getValue(),//ATTEMPT 5
inputS.getRange("T30").getValue(),//ATTEMPT 6
inputS.getRange("V30").getValue(),//ATTEMPT 7
inputS.getRange("X30").getValue(),//ATTEMPT 8
inputS.getRange("Z30").getValue(),//ATTEMPT 9
inputS.getRange("AB30").getValue(),//ATTEMPT 10
inputS.getRange("AD30").getValue(),//ATTEMPT 11
inputS.getRange("AF30").getValue(),//ATTEMPT 12
dtCurrentTime]];

routinesS.getRange(routinesS.getLastRow()+1, 1, 1, 20).setValues(routines);

}                     

```

![sheet structure](https://i.stack.imgur.com/OfM7z.png)