Forum Discussion
Struggling with an office script
I've got a list of ingredients that the user can input onto a table. I'd like them to be able to save this list to create a recipe by clicking a script button. This would then transpose the data, copy and paste as values, then clear the original data. the problem is I'm not sure how to repeat it. The script should ideally go to the next empty row (or at least 4 rows as the data will be 4 rows). Can anyone help?
The script recorded was this. I am not good at java at all so I'm not sure how to get it to find the next empty row:
1 Reply
- JKPieterseSilver Contributor
Change this line:
recipeList.getRange("A2").copyFrom(recipeList.getRange("A2:T4"), ExcelScript.RangeCopyType.values, false, false);
to:
recipeList.getRange("A1000000").getRangeEdge(ExcelScript.KeyboardDirection.up).getOffsetRange(1,0).copyFrom(recipeList.getRange("A2:T4"), ExcelScript.RangeCopyType.values, false, false);