Data submit form - reducing code - help please!!!

144 views
Skip to first unread message

Elliot Stratton

unread,
Jul 21, 2020, 5:03:49 AM7/21/20
to Google Apps Script Community
Hi Everyone

I am very new to using scripts and any sort of coding for that! 

I have built a training diary sheet for the athletes I coach, where they record what they have done in training. I have built in a button to run a submit data script which then sends their training session data to a main sheet for me to analyse. 

I have it working fine for basic data transfer. However I want to now try and transfer a lot more data from the sheet so I can analyse athletes training output more. Currently in my submit data script (which works fine), I have each cell I want transferred individually selected (there is only 45 cells) as below :

                    inputS.getRange("AW3").getValue(),


However, I now have 40 rows that I need 23 cells from each row submitted. These cells are in 3 seperate collections (M:P, A:H and J:U)

The M1:P1  section will be constant on every row of data I need, the A:H and J:U will be for:

rows 14 to 23
rows 29 to 38 
rows 44 to 53
rows 59 to 68 

I would like each rows cells, to appear as their own row in the data sheet when transferred. 

Is there an easy way to do this as opposed to individually selecting the 920 required cells in their own line of code? I have tried to use getRange to select the 3 sections of cells, however when I try to run the script, it tells me the highlighted below (the 23 cells I want) doesn't match the get data and says there is only 3 rows (the 3 sections I am trying to get)

    workloadS.getRange(workloadS.getLastRow()+1, 1, 1, 23).setValues(workloads);) 


Can anyone help me with this at all!!! Thanks in advance if this is a simple and dumb question!


Reply all
Reply to author
Forward
0 new messages